FlixOlé v4.4.0版本的 MD5 值为:50e7f767ca3e8715936523e9ef089581

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


package i.d.d.w.r;

import andhook.lib.xposed.callbacks.XCallback;
import android.content.Context;
import android.content.pm.PackageManager;
import android.net.TrafficStats;
import android.text.TextUtils;
import android.util.JsonReader;
import android.util.Log;
import com.magine.android.mamo.api.PioneerServiceSource;
import com.magine.api.base.ApiHeaders;
import i.d.a.d.f.q.q;
import i.d.a.d.f.t.j;
import i.d.d.s.f;
import i.d.d.w.i;
import i.d.d.w.r.d;
import i.d.d.w.r.f;
import i.d.d.z.i;
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.util.regex.Pattern;
import java.util.zip.GZIPOutputStream;
public class c {
    public static final Pattern e = Pattern.compile("[0-9]+s");
    public static final Charset f8030f = Charset.forName("UTF-8");
    public final Context a;
    public final i.d.d.v.b<i> b;
    public final i.d.d.v.b<i.d.d.s.f> c;
    public final e d = new e();

    public c(Context context, i.d.d.v.b<i> bVar, i.d.d.v.b<i.d.d.s.f> bVar2) {
        this.a = context;
        this.b = bVar;
        this.c = bVar2;
    }

    public static String a(String str, String str2, String str3) {
        String str4;
        Object[] objArr = new Object[3];
        objArr[0] = str2;
        objArr[1] = str3;
        if (TextUtils.isEmpty(str)) {
            str4 = "";
        } else {
            str4 = ", " + str;
        }
        objArr[2] = str4;
        return String.format("Firebase options used while communicating with Firebase server APIs: %s, %s%s", objArr);
    }

    public static o.b.c b(String str, String str2) {
        try {
            o.b.c cVar = new o.b.c();
            cVar.J("fid", str);
            cVar.J("appId", str2);
            cVar.J("authVersion", "FIS_v2");
            cVar.J("sdkVersion", "a:17.0.0");
            return cVar;
        } catch (o.b.b e2) {
            throw new IllegalStateException(e2);
        }
    }

    public static o.b.c c() {
        try {
            o.b.c cVar = new o.b.c();
            cVar.J("sdkVersion", "a:17.0.0");
            o.b.c cVar2 = new o.b.c();
            cVar2.J("installation", cVar);
            return cVar2;
        } catch (o.b.b e2) {
            throw new IllegalStateException(e2);
        }
    }

    public static byte[] h(o.b.c cVar) throws IOException {
        return cVar.toString().getBytes("UTF-8");
    }

    public static boolean i(int i2) {
        return i2 >= 200 && i2 < 300;
    }

    public static void j() {
        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.");
    }

    public static void k(HttpURLConnection httpURLConnection, String str, String str2, String str3) {
        String o2 = o(httpURLConnection);
        if (TextUtils.isEmpty(o2)) {
            return;
        }
        Log.w("Firebase-Installations", o2);
        Log.w("Firebase-Installations", a(str, str2, str3));
    }

    public static long m(String str) {
        q.b(e.matcher(str).matches(), "Invalid Expiration Timestamp.");
        if (str == null || str.length() == 0) {
            return 0L;
        }
        return Long.parseLong(str.substring(0, str.length() - 1));
    }

    public static String o(HttpURLConnection httpURLConnection) {
        InputStream errorStream = httpURLConnection.getErrorStream();
        if (errorStream == null) {
            return null;
        }
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(errorStream, f8030f));
        try {
            try {
                StringBuilder sb = new StringBuilder();
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    sb.append(readLine);
                    sb.append('\n');
                }
                String format = String.format("Error when communicating with the Firebase Installations server API. HTTP response: [%d %s: %s]", Integer.valueOf(httpURLConnection.getResponseCode()), httpURLConnection.getResponseMessage(), sb);
                try {
                    bufferedReader.close();
                } catch (IOException unused) {
                }
                return format;
            } catch (IOException unused2) {
                return null;
            }
        } catch (IOException unused3) {
            bufferedReader.close();
            return null;
        } catch (Throwable th) {
            try {
                bufferedReader.close();
            } catch (IOException unused4) {
            }
            throw th;
        }
    }

    public static void s(URLConnection uRLConnection, byte[] bArr) throws IOException {
        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 d d(String str, String str2, String str3, String str4, String str5) throws i.d.d.w.i {
        int responseCode;
        d n2;
        if (this.d.b()) {
            URL g2 = g(String.format("projects/%s/installations", str3));
            for (int i2 = 0; i2 <= 1; i2++) {
                TrafficStats.setThreadStatsTag(32769);
                HttpURLConnection l2 = l(g2, str);
                try {
                    l2.setRequestMethod(PioneerServiceSource.POST);
                    l2.setDoOutput(true);
                    if (str5 != null) {
                        l2.addRequestProperty("x-goog-fis-android-iid-migration-auth", str5);
                    }
                    q(l2, str2, str4);
                    responseCode = l2.getResponseCode();
                    this.d.f(responseCode);
                } catch (IOException | AssertionError unused) {
                } catch (Throwable th) {
                    l2.disconnect();
                    TrafficStats.clearThreadStatsTag();
                    throw th;
                }
                if (i(responseCode)) {
                    n2 = n(l2);
                } else {
                    k(l2, str4, str, str3);
                    if (responseCode == 429) {
                        throw new i.d.d.w.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) {
                        j();
                        d.a a = d.a();
                        a.e(d.b.BAD_CONFIG);
                        n2 = a.a();
                    } else {
                        l2.disconnect();
                        TrafficStats.clearThreadStatsTag();
                    }
                }
                l2.disconnect();
                TrafficStats.clearThreadStatsTag();
                return n2;
            }
            throw new i.d.d.w.i("Firebase Installations Service is unavailable. Please try again later.", i.a.UNAVAILABLE);
        }
        throw new i.d.d.w.i("Firebase Installations Service is unavailable. Please try again later.", i.a.UNAVAILABLE);
    }

    public f e(String str, String str2, String str3, String str4) throws i.d.d.w.i {
        int responseCode;
        f p2;
        f.a a;
        if (this.d.b()) {
            URL g2 = g(String.format("projects/%s/installations/%s/authTokens:generate", str3, str2));
            for (int i2 = 0; i2 <= 1; i2++) {
                TrafficStats.setThreadStatsTag(32771);
                HttpURLConnection l2 = l(g2, str);
                try {
                    l2.setRequestMethod(PioneerServiceSource.POST);
                    l2.addRequestProperty(ApiHeaders.AUTHORIZATION, "FIS_v2 " + str4);
                    l2.setDoOutput(true);
                    r(l2);
                    responseCode = l2.getResponseCode();
                    this.d.f(responseCode);
                } catch (IOException | AssertionError unused) {
                } catch (Throwable th) {
                    l2.disconnect();
                    TrafficStats.clearThreadStatsTag();
                    throw th;
                }
                if (i(responseCode)) {
                    p2 = p(l2);
                } else {
                    k(l2, null, str, str3);
                    if (responseCode != 401 && responseCode != 404) {
                        if (responseCode == 429) {
                            throw new i.d.d.w.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) {
                            j();
                            a = f.a();
                            a.b(f.b.BAD_CONFIG);
                            p2 = a.a();
                        } else {
                            l2.disconnect();
                            TrafficStats.clearThreadStatsTag();
                        }
                    }
                    a = f.a();
                    a.b(f.b.AUTH_ERROR);
                    p2 = a.a();
                }
                l2.disconnect();
                TrafficStats.clearThreadStatsTag();
                return p2;
            }
            throw new i.d.d.w.i("Firebase Installations Service is unavailable. Please try again later.", i.a.UNAVAILABLE);
        }
        throw new i.d.d.w.i("Firebase Installations Service is unavailable. Please try again later.", i.a.UNAVAILABLE);
    }

    public final String f() {
        try {
            Context context = this.a;
            byte[] a = i.d.a.d.f.t.a.a(context, context.getPackageName());
            if (a == null) {
                Log.e("ContentValues", "Could not get fingerprint hash for package: " + this.a.getPackageName());
                return null;
            }
            return j.b(a, false);
        } catch (PackageManager.NameNotFoundException e2) {
            Log.e("ContentValues", "No such package: " + this.a.getPackageName(), e2);
            return null;
        }
    }

    public final URL g(String str) throws i.d.d.w.i {
        try {
            return new URL(String.format("https://%s/%s/%s", "firebaseinstallations.googleapis.com", "v1", str));
        } catch (MalformedURLException e2) {
            throw new i.d.d.w.i(e2.getMessage(), i.a.UNAVAILABLE);
        }
    }

    public final HttpURLConnection l(URL url, String str) throws i.d.d.w.i {
        f.a a;
        try {
            HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
            httpURLConnection.setConnectTimeout(XCallback.PRIORITY_HIGHEST);
            httpURLConnection.setUseCaches(false);
            httpURLConnection.setReadTimeout(XCallback.PRIORITY_HIGHEST);
            httpURLConnection.addRequestProperty("Content-Type", "application/json");
            httpURLConnection.addRequestProperty("Accept", "application/json");
            httpURLConnection.addRequestProperty("Content-Encoding", "gzip");
            httpURLConnection.addRequestProperty("Cache-Control", "no-cache");
            httpURLConnection.addRequestProperty("X-Android-Package", this.a.getPackageName());
            if (this.c.get() != null && this.b.get() != null && (a = this.c.get().a("fire-installations-id")) != f.a.NONE) {
                httpURLConnection.addRequestProperty("x-firebase-client", this.b.get().a());
                httpURLConnection.addRequestProperty("x-firebase-client-log-type", Integer.toString(a.c()));
            }
            httpURLConnection.addRequestProperty("X-Android-Cert", f());
            httpURLConnection.addRequestProperty("x-goog-api-key", str);
            return httpURLConnection;
        } catch (IOException unused) {
            throw new i.d.d.w.i("Firebase Installations Service is unavailable. Please try again later.", i.a.UNAVAILABLE);
        }
    }

    public final d n(HttpURLConnection httpURLConnection) throws AssertionError, IOException {
        InputStream inputStream = httpURLConnection.getInputStream();
        JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f8030f));
        f.a a = f.a();
        d.a a2 = d.a();
        jsonReader.beginObject();
        while (jsonReader.hasNext()) {
            String nextName = jsonReader.nextName();
            if (nextName.equals("name")) {
                a2.f(jsonReader.nextString());
            } else if (nextName.equals("fid")) {
                a2.c(jsonReader.nextString());
            } else if (nextName.equals("refreshToken")) {
                a2.d(jsonReader.nextString());
            } else if (nextName.equals("authToken")) {
                jsonReader.beginObject();
                while (jsonReader.hasNext()) {
                    String nextName2 = jsonReader.nextName();
                    if (nextName2.equals("token")) {
                        a.c(jsonReader.nextString());
                    } else if (nextName2.equals("expiresIn")) {
                        a.d(m(jsonReader.nextString()));
                    } else {
                        jsonReader.skipValue();
                    }
                }
                a2.b(a.a());
                jsonReader.endObject();
            } else {
                jsonReader.skipValue();
            }
        }
        jsonReader.endObject();
        jsonReader.close();
        inputStream.close();
        a2.e(d.b.OK);
        return a2.a();
    }

    public final f p(HttpURLConnection httpURLConnection) throws AssertionError, IOException {
        InputStream inputStream = httpURLConnection.getInputStream();
        JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f8030f));
        f.a a = f.a();
        jsonReader.beginObject();
        while (jsonReader.hasNext()) {
            String nextName = jsonReader.nextName();
            if (nextName.equals("token")) {
                a.c(jsonReader.nextString());
            } else if (nextName.equals("expiresIn")) {
                a.d(m(jsonReader.nextString()));
            } else {
                jsonReader.skipValue();
            }
        }
        jsonReader.endObject();
        jsonReader.close();
        inputStream.close();
        a.b(f.b.OK);
        return a.a();
    }

    public final void q(HttpURLConnection httpURLConnection, String str, String str2) throws IOException {
        s(httpURLConnection, h(b(str, str2)));
    }

    public final void r(HttpURLConnection httpURLConnection) throws IOException {
        s(httpURLConnection, h(c()));
    }
}