导航菜单

页面标题

页面副标题

BetterTogether v3.0.0 - d.java 源代码

正在查看: BetterTogether v3.0.0 应用的 d.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package vm;

import android.net.TrafficStats;
import android.util.Log;
import androidx.appcompat.widget.a4;
import bb.r;
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 hl.o;
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.regex.Pattern;
import org.json.JSONException;
import org.json.JSONObject;

public final class d implements e {
    public static final Object m = new Object();
    public final al.g a;
    public final xm.c b;
    public final b c;
    public final k d;
    public final o e;
    public final i f;
    public final Object g;
    public final ExecutorService h;
    public final Executor i;
    public String j;
    public final HashSet k;
    public final ArrayList l;

    static {
        new androidx.loader.content.f(1);
    }

    public d(al.g gVar, um.c cVar, ExecutorService executorService, il.k kVar) {
        gVar.a();
        xm.c cVar2 = new xm.c(gVar.a, cVar);
        b bVar = new b(gVar, 1);
        if (tl.a.e == null) {
            tl.a.e = new tl.a(5);
        }
        tl.a aVar = tl.a.e;
        if (k.d == null) {
            k.d = new k(aVar);
        }
        k kVar2 = k.d;
        o oVar = new o(new hl.d(gVar, 2));
        i iVar = new i();
        this.g = new Object();
        this.k = new HashSet();
        this.l = new ArrayList();
        this.a = gVar;
        this.b = cVar2;
        this.c = bVar;
        this.d = kVar2;
        this.e = oVar;
        this.f = iVar;
        this.h = executorService;
        this.i = kVar;
    }

    public final void a(boolean r8) {
        throw new UnsupportedOperationException("Method not decompiled: vm.d.a(boolean):void");
    }

    public final wm.a b(wm.a aVar) {
        boolean z;
        int responseCode;
        xm.b f;
        al.g gVar = this.a;
        gVar.a();
        String str = gVar.c.a;
        String str2 = aVar.a;
        al.g gVar2 = this.a;
        gVar2.a();
        String str3 = gVar2.c.g;
        String str4 = aVar.d;
        xm.c cVar = this.b;
        xm.e eVar = cVar.c;
        synchronized (eVar) {
            if (eVar.c != 0) {
                eVar.a.a.getClass();
                z = System.currentTimeMillis() > eVar.b;
            }
        }
        if (!z) {
            throw new f("Firebase Installations Service is unavailable. Please try again later.");
        }
        URL a = xm.c.a(String.format("projects/%s/installations/%s/authTokens:generate", str3, str2));
        for (int i = 0; i <= 1; i++) {
            TrafficStats.setThreadStatsTag(32771);
            HttpURLConnection c = cVar.c(a, str);
            try {
                c.setRequestMethod("POST");
                c.addRequestProperty("Authorization", "FIS_v2 " + str4);
                c.setDoOutput(true);
                xm.c.h(c);
                responseCode = c.getResponseCode();
                eVar.a(responseCode);
            } catch (IOException | AssertionError unused) {
            } catch (Throwable th) {
                c.disconnect();
                TrafficStats.clearThreadStatsTag();
                throw th;
            }
            if (responseCode >= 200 && responseCode < 300) {
                f = xm.c.f(c);
            } else {
                xm.c.b(c, null, str, str3);
                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.");
                    }
                    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.");
                        r a2 = xm.b.a();
                        a2.v = xm.f.BAD_CONFIG;
                        f = a2.u();
                    } else {
                        c.disconnect();
                        TrafficStats.clearThreadStatsTag();
                    }
                }
                r a3 = xm.b.a();
                a3.v = xm.f.AUTH_ERROR;
                f = a3.u();
            }
            c.disconnect();
            TrafficStats.clearThreadStatsTag();
            int ordinal = f.c.ordinal();
            if (ordinal == 0) {
                k kVar = this.d;
                kVar.getClass();
                TimeUnit timeUnit = TimeUnit.MILLISECONDS;
                kVar.a.getClass();
                long seconds = timeUnit.toSeconds(System.currentTimeMillis());
                a4 a4Var = new a4(aVar);
                a4Var.c = f.a;
                a4Var.e = Long.valueOf(f.b);
                a4Var.f = Long.valueOf(seconds);
                return a4Var.j();
            }
            if (ordinal == 1) {
                a4 a4Var2 = new a4(aVar);
                a4Var2.g = "BAD CONFIG";
                a4Var2.k(wm.c.REGISTER_ERROR);
                return a4Var2.j();
            }
            if (ordinal != 2) {
                throw new f("Firebase Installations Service is unavailable. Please try again later.");
            }
            synchronized (this) {
                this.j = null;
            }
            a4 a4Var3 = new a4(aVar);
            a4Var3.k(wm.c.NOT_GENERATED);
            return a4Var3.j();
        }
        throw new f("Firebase Installations Service is unavailable. Please try again later.");
    }

    public final Task c() {
        String str;
        e();
        synchronized (this) {
            str = this.j;
        }
        if (str != null) {
            return Tasks.forResult(str);
        }
        TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
        h hVar = new h(taskCompletionSource);
        synchronized (this.g) {
            this.l.add(hVar);
        }
        Task task = taskCompletionSource.getTask();
        this.h.execute(new md.a(this, 14));
        return task;
    }

    public final Task d() {
        e();
        TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
        g gVar = new g(this.d, taskCompletionSource);
        synchronized (this.g) {
            this.l.add(gVar);
        }
        Task task = taskCompletionSource.getTask();
        this.h.execute(new c(this, false, 1));
        return task;
    }

    public final void e() {
        al.g gVar = this.a;
        gVar.a();
        Preconditions.checkNotEmpty(gVar.c.b, "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();
        Preconditions.checkNotEmpty(gVar.c.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.");
        gVar.a();
        Preconditions.checkNotEmpty(gVar.c.a, "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.a();
        String str = gVar.c.b;
        Pattern pattern = k.c;
        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.");
        gVar.a();
        Preconditions.checkArgument(k.c.matcher(gVar.c.a).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 java.lang.String f(wm.a r6) {
        throw new UnsupportedOperationException("Method not decompiled: vm.d.f(wm.a):java.lang.String");
    }

    public final wm.a g(wm.a aVar) {
        boolean z;
        int responseCode;
        xm.a e;
        String str = aVar.a;
        String str2 = null;
        if (str != null && str.length() == 11) {
            wm.b bVar = (wm.b) this.e.get();
            synchronized (bVar.a) {
                String[] strArr = wm.b.c;
                int i = 0;
                while (true) {
                    if (i >= 4) {
                        break;
                    }
                    String string = bVar.a.getString("|T|" + bVar.b + "|" + strArr[i], null);
                    if (string == null || string.isEmpty()) {
                        i++;
                    } else if (string.startsWith("{")) {
                        try {
                            str2 = new JSONObject(string).getString("token");
                        } catch (JSONException unused) {
                        }
                    } else {
                        str2 = string;
                    }
                }
            }
        }
        xm.c cVar = this.b;
        al.g gVar = this.a;
        gVar.a();
        String str3 = gVar.c.a;
        String str4 = aVar.a;
        al.g gVar2 = this.a;
        gVar2.a();
        String str5 = gVar2.c.g;
        al.g gVar3 = this.a;
        gVar3.a();
        String str6 = gVar3.c.b;
        xm.e eVar = cVar.c;
        synchronized (eVar) {
            if (eVar.c != 0) {
                eVar.a.a.getClass();
                z = System.currentTimeMillis() > eVar.b;
            }
        }
        if (!z) {
            throw new f("Firebase Installations Service is unavailable. Please try again later.");
        }
        URL a = xm.c.a(String.format("projects/%s/installations", str5));
        for (int i2 = 0; i2 <= 1; i2++) {
            TrafficStats.setThreadStatsTag(32769);
            HttpURLConnection c = cVar.c(a, str3);
            try {
                try {
                    c.setRequestMethod("POST");
                    c.setDoOutput(true);
                    if (str2 != null) {
                        c.addRequestProperty("x-goog-fis-android-iid-migration-auth", str2);
                    }
                    xm.c.g(c, str4, str6);
                    responseCode = c.getResponseCode();
                    eVar.a(responseCode);
                } catch (Throwable th) {
                    c.disconnect();
                    TrafficStats.clearThreadStatsTag();
                    throw th;
                }
            } catch (IOException | AssertionError unused2) {
            }
            if (responseCode >= 200 && responseCode < 300) {
                e = xm.c.e(c);
            } else {
                xm.c.b(c, str6, str3, str5);
                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.");
                }
                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.");
                    s8.h hVar = new s8.h(12);
                    hVar.e = xm.d.BAD_CONFIG;
                    e = hVar.h();
                } else {
                    c.disconnect();
                    TrafficStats.clearThreadStatsTag();
                }
            }
            c.disconnect();
            TrafficStats.clearThreadStatsTag();
            int ordinal = e.e.ordinal();
            if (ordinal != 0) {
                if (ordinal != 1) {
                    throw new f("Firebase Installations Service is unavailable. Please try again later.");
                }
                a4 a4Var = new a4(aVar);
                a4Var.g = "BAD CONFIG";
                a4Var.k(wm.c.REGISTER_ERROR);
                return a4Var.j();
            }
            String str7 = e.b;
            String str8 = e.c;
            k kVar = this.d;
            kVar.getClass();
            TimeUnit timeUnit = TimeUnit.MILLISECONDS;
            kVar.a.getClass();
            long seconds = timeUnit.toSeconds(System.currentTimeMillis());
            xm.b bVar2 = e.d;
            String str9 = bVar2.a;
            long j = bVar2.b;
            a4 a4Var2 = new a4(aVar);
            a4Var2.a = str7;
            a4Var2.k(wm.c.REGISTERED);
            a4Var2.c = str9;
            a4Var2.d = str8;
            a4Var2.e = Long.valueOf(j);
            a4Var2.f = Long.valueOf(seconds);
            return a4Var2.j();
        }
        throw new f("Firebase Installations Service is unavailable. Please try again later.");
    }

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

    public final void i(wm.a aVar) {
        synchronized (this.g) {
            Iterator it = this.l.iterator();
            while (it.hasNext()) {
                if (((j) it.next()).b(aVar)) {
                    it.remove();
                }
            }
        }
    }
}