ZBZB Slots v1.0.0版本的 MD5 值为:81141cde9546bf134b1f45a76b103adb

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


package a5;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.text.TextUtils;
import android.util.JsonReader;
import android.util.Log;
import com.adjust.sdk.Constants;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.concurrent.ExecutionException;
import java.util.regex.Pattern;
import java.util.zip.GZIPOutputStream;
import org.json.JSONException;
import org.json.JSONObject;
import w5.p;
public final class c {
    public static final Pattern f180d = Pattern.compile("[0-9]+s");
    public static final Charset f181e = Charset.forName(Constants.ENCODING);
    public final Context f182a;
    public final x4.a f183b;
    public final e f184c = new e();

    public c(Context context, x4.a aVar) {
        this.f182a = context;
        this.f183b = aVar;
    }

    public static URL a(String str) {
        try {
            return new URL(String.format("https://%s/%s/%s", "firebaseinstallations.googleapis.com", "v1", str));
        } catch (MalformedURLException e6) {
            throw new y4.e(e6.getMessage());
        }
    }

    public static void b(HttpURLConnection httpURLConnection, String str, String str2, String str3) {
        String str4;
        InputStream errorStream = httpURLConnection.getErrorStream();
        String str5 = null;
        if (errorStream != null) {
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(errorStream, f181e));
            try {
                StringBuilder sb = new StringBuilder();
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    sb.append(readLine);
                    sb.append('\n');
                }
                str5 = String.format("Error when communicating with the Firebase Installations server API. HTTP response: [%d %s: %s]", Integer.valueOf(httpURLConnection.getResponseCode()), httpURLConnection.getResponseMessage(), sb);
            } catch (IOException unused) {
            } catch (Throwable th) {
                try {
                    bufferedReader.close();
                } catch (IOException unused2) {
                }
                throw th;
            }
            try {
                bufferedReader.close();
            } catch (IOException unused3) {
            }
        }
        if (!TextUtils.isEmpty(str5)) {
            Log.w("Firebase-Installations", str5);
            Object[] objArr = new Object[3];
            objArr[0] = str2;
            objArr[1] = str3;
            if (TextUtils.isEmpty(str)) {
                str4 = "";
            } else {
                str4 = ", " + str;
            }
            objArr[2] = str4;
            Log.w("Firebase-Installations", String.format("Firebase options used while communicating with Firebase server APIs: %s, %s%s", objArr));
        }
    }

    public static long d(String str) {
        if (f180d.matcher(str).matches()) {
            if (str != null && str.length() != 0) {
                return Long.parseLong(str.substring(0, str.length() - 1));
            }
            return 0L;
        }
        throw new IllegalArgumentException("Invalid Expiration Timestamp.");
    }

    public static a e(HttpURLConnection httpURLConnection) {
        InputStream inputStream = httpURLConnection.getInputStream();
        JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f181e));
        d.c a6 = b.a();
        jsonReader.beginObject();
        String str = null;
        String str2 = null;
        String str3 = null;
        b bVar = null;
        while (jsonReader.hasNext()) {
            String nextName = jsonReader.nextName();
            if (nextName.equals("name")) {
                str = jsonReader.nextString();
            } else if (nextName.equals("fid")) {
                str2 = jsonReader.nextString();
            } else if (nextName.equals("refreshToken")) {
                str3 = jsonReader.nextString();
            } else if (nextName.equals("authToken")) {
                jsonReader.beginObject();
                while (jsonReader.hasNext()) {
                    String nextName2 = jsonReader.nextName();
                    if (nextName2.equals("token")) {
                        a6.f2552b = jsonReader.nextString();
                    } else if (nextName2.equals("expiresIn")) {
                        a6.f2553c = Long.valueOf(d(jsonReader.nextString()));
                    } else {
                        jsonReader.skipValue();
                    }
                }
                bVar = a6.g();
                jsonReader.endObject();
            } else {
                jsonReader.skipValue();
            }
        }
        jsonReader.endObject();
        jsonReader.close();
        inputStream.close();
        return new a(str, str2, str3, bVar, d.OK);
    }

    public static b f(HttpURLConnection httpURLConnection) {
        InputStream inputStream = httpURLConnection.getInputStream();
        JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f181e));
        d.c a6 = b.a();
        jsonReader.beginObject();
        while (jsonReader.hasNext()) {
            String nextName = jsonReader.nextName();
            if (nextName.equals("token")) {
                a6.f2552b = jsonReader.nextString();
            } else if (nextName.equals("expiresIn")) {
                a6.f2553c = Long.valueOf(d(jsonReader.nextString()));
            } else {
                jsonReader.skipValue();
            }
        }
        jsonReader.endObject();
        jsonReader.close();
        inputStream.close();
        a6.f2554d = f.OK;
        return a6.g();
    }

    public static void g(HttpURLConnection httpURLConnection, String str, String str2) {
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("fid", str);
            jSONObject.put("appId", str2);
            jSONObject.put("authVersion", "FIS_v2");
            jSONObject.put("sdkVersion", "a:17.2.0");
            i(httpURLConnection, jSONObject.toString().getBytes(Constants.ENCODING));
        } catch (JSONException e6) {
            throw new IllegalStateException(e6);
        }
    }

    public static void h(HttpURLConnection httpURLConnection) {
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("sdkVersion", "a:17.2.0");
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put("installation", jSONObject);
            i(httpURLConnection, jSONObject2.toString().getBytes(Constants.ENCODING));
        } catch (JSONException e6) {
            throw new IllegalStateException(e6);
        }
    }

    public static void i(URLConnection uRLConnection, byte[] bArr) {
        OutputStream outputStream = uRLConnection.getOutputStream();
        if (outputStream == null) {
            throw new IOException("Cannot send request to FIS servers. No OutputStream available.");
        }
        GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(outputStream);
        try {
            gZIPOutputStream.write(bArr);
        } finally {
            try {
                gZIPOutputStream.close();
                outputStream.close();
            } catch (IOException unused) {
            }
        }
    }

    public final HttpURLConnection c(URL url, String str) {
        PackageInfo packageInfo;
        Signature[] signatureArr;
        byte[] bArr;
        int i6;
        MessageDigest messageDigest;
        try {
            HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
            httpURLConnection.setConnectTimeout(10000);
            httpURLConnection.setUseCaches(false);
            httpURLConnection.setReadTimeout(10000);
            httpURLConnection.addRequestProperty("Content-Type", "application/json");
            httpURLConnection.addRequestProperty("Accept", "application/json");
            httpURLConnection.addRequestProperty("Content-Encoding", "gzip");
            httpURLConnection.addRequestProperty("Cache-Control", "no-cache");
            Context context = this.f182a;
            httpURLConnection.addRequestProperty("X-Android-Package", context.getPackageName());
            v4.e eVar = (v4.e) this.f183b.get();
            if (eVar != null) {
                try {
                    httpURLConnection.addRequestProperty("x-firebase-client", (String) i5.f.a(((v4.c) eVar).a()));
                } catch (InterruptedException e6) {
                    e = e6;
                    Thread.currentThread().interrupt();
                    Log.w("ContentValues", "Failed to get heartbeats header", e);
                    String str2 = null;
                    packageInfo = c3.b.a(context).f1002a.getPackageManager().getPackageInfo(context.getPackageName(), 64);
                    signatureArr = packageInfo.signatures;
                    if (signatureArr != null) {
                        i6 = 0;
                        while (true) {
                            if (i6 >= 2) {
                            }
                            i6++;
                        }
                        if (messageDigest != null) {
                        }
                    }
                    bArr = null;
                    if (bArr != null) {
                    }
                    httpURLConnection.addRequestProperty("X-Android-Cert", str2);
                    httpURLConnection.addRequestProperty("x-goog-api-key", str);
                    return httpURLConnection;
                } catch (ExecutionException e7) {
                    e = e7;
                    Log.w("ContentValues", "Failed to get heartbeats header", e);
                    String str22 = null;
                    packageInfo = c3.b.a(context).f1002a.getPackageManager().getPackageInfo(context.getPackageName(), 64);
                    signatureArr = packageInfo.signatures;
                    if (signatureArr != null) {
                    }
                    bArr = null;
                    if (bArr != null) {
                    }
                    httpURLConnection.addRequestProperty("X-Android-Cert", str22);
                    httpURLConnection.addRequestProperty("x-goog-api-key", str);
                    return httpURLConnection;
                }
            }
            String str222 = null;
            try {
                packageInfo = c3.b.a(context).f1002a.getPackageManager().getPackageInfo(context.getPackageName(), 64);
                signatureArr = packageInfo.signatures;
            } catch (PackageManager.NameNotFoundException e8) {
                Log.e("ContentValues", "No such package: " + context.getPackageName(), e8);
            }
            if (signatureArr != null && signatureArr.length == 1) {
                i6 = 0;
                while (true) {
                    if (i6 >= 2) {
                        try {
                            messageDigest = MessageDigest.getInstance("SHA1");
                        } catch (NoSuchAlgorithmException unused) {
                        }
                        if (messageDigest != null) {
                            break;
                        }
                        i6++;
                    } else {
                        messageDigest = null;
                        break;
                    }
                }
                if (messageDigest != null) {
                    bArr = messageDigest.digest(packageInfo.signatures[0].toByteArray());
                    if (bArr != null) {
                        Log.e("ContentValues", "Could not get fingerprint hash for package: " + context.getPackageName());
                    } else {
                        int length = bArr.length;
                        StringBuilder sb = new StringBuilder(length + length);
                        for (int i7 = 0; i7 < length; i7++) {
                            char[] cArr = p.f5586l;
                            sb.append(cArr[(bArr[i7] & 240) >>> 4]);
                            sb.append(cArr[bArr[i7] & 15]);
                        }
                        str222 = sb.toString();
                    }
                    httpURLConnection.addRequestProperty("X-Android-Cert", str222);
                    httpURLConnection.addRequestProperty("x-goog-api-key", str);
                    return httpURLConnection;
                }
            }
            bArr = null;
            if (bArr != null) {
            }
            httpURLConnection.addRequestProperty("X-Android-Cert", str222);
            httpURLConnection.addRequestProperty("x-goog-api-key", str);
            return httpURLConnection;
        } catch (IOException unused2) {
            throw new y4.e("Firebase Installations Service is unavailable. Please try again later.");
        }
    }
}