导航菜单

页面标题

页面副标题

All File Recovery v1.0.2 - c.java 源代码

正在查看: All File Recovery v1.0.2 应用的 c.java JAVA 源代码文件

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


package F9;

import A9.l;
import F.w;
import F9.a;
import F9.b;
import F9.d;
import F9.f;
import R9.E;
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 androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.gms.common.internal.Preconditions;
import com.google.android.gms.common.util.AndroidUtilsLight;
import com.google.android.gms.common.util.Hex;
import com.google.android.gms.tasks.Tasks;
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.concurrent.ExecutionException;
import java.util.regex.Pattern;
import java.util.zip.GZIPOutputStream;
import l.i0;
import org.json.JSONException;
import org.json.JSONObject;
import x9.j;
import z9.InterfaceC1110b;

public class c {
    public static final String A = "x-goog-api-key";
    public static final int B = 10000;
    public static final int D = 1;
    public static final String F = "a:";
    public static final String G = "Firebase-Installations";

    @i0
    public static final String H = "Invalid Expiration Timestamp.";
    public static final int e = 32768;
    public static final int f = 32769;
    public static final int g = 32770;
    public static final int h = 32771;
    public static final String i = "firebaseinstallations.googleapis.com";
    public static final String j = "projects/%s/installations";
    public static final String k = "projects/%s/installations/%s/authTokens:generate";
    public static final String l = "projects/%s/installations/%s";
    public static final String m = "v1";
    public static final String n = "FIS_v2";
    public static final String o = "Content-Type";
    public static final String p = "Accept";
    public static final String q = "application/json";
    public static final String r = "Content-Encoding";
    public static final String s = "gzip";
    public static final String t = "Cache-Control";
    public static final String u = "no-cache";
    public static final String v = "fire-installations-id";
    public static final String w = "x-firebase-client";
    public static final String x = "X-Android-Package";
    public static final String y = "X-Android-Cert";
    public static final String z = "x-goog-fis-android-iid-migration-auth";
    public boolean a;
    public final Context b;
    public final InterfaceC1110b<j> c;
    public final e d = new e();
    public static final Pattern C = Pattern.compile("[0-9]+s");
    public static final Charset E = Charset.forName("UTF-8");

    public c(@NonNull Context context, @NonNull InterfaceC1110b<j> interfaceC1110b) {
        this.b = context;
        this.c = interfaceC1110b;
    }

    public static String a(@Nullable String str, @NonNull String str2, @NonNull String str3) {
        return String.format("Firebase options used while communicating with Firebase server APIs: %s, %s%s", str2, str3, TextUtils.isEmpty(str) ? "" : w.a(", ", str));
    }

    public static JSONObject b(@Nullable String str, @NonNull String str2) {
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("fid", str);
            jSONObject.put(E.b.D, str2);
            jSONObject.put("authVersion", n);
            jSONObject.put(E.b.L, "a:18.0.0");
            return jSONObject;
        } catch (JSONException e2) {
            throw new IllegalStateException(e2);
        }
    }

    public static JSONObject c() {
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put(E.b.L, "a:18.0.0");
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put("installation", jSONObject);
            return jSONObject2;
        } catch (JSONException e2) {
            throw new IllegalStateException(e2);
        }
    }

    public static byte[] i(JSONObject jSONObject) throws IOException {
        return jSONObject.toString().getBytes("UTF-8");
    }

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

    public static void k() {
        Log.e(G, "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 l(HttpURLConnection httpURLConnection, @Nullable String str, @NonNull String str2, @NonNull String str3) {
        String p2 = p(httpURLConnection);
        if (TextUtils.isEmpty(p2)) {
            return;
        }
        Log.w(G, p2);
        Log.w(G, a(str, str2, str3));
    }

    @i0
    public static long n(String str) {
        Preconditions.checkArgument(C.matcher(str).matches(), H);
        if (str == null || str.length() == 0) {
            return 0L;
        }
        return Long.parseLong(str.substring(0, str.length() - 1));
    }

    @Nullable
    public static String p(HttpURLConnection httpURLConnection) {
        InputStream errorStream = httpURLConnection.getErrorStream();
        if (errorStream == null) {
            return null;
        }
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(errorStream, E));
        try {
            try {
                StringBuilder sb2 = new StringBuilder();
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    sb2.append(readLine);
                    sb2.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(), sb2);
                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 t(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) {
            }
        }
    }

    @NonNull
    public d d(@NonNull String str, @Nullable String str2, @NonNull String str3, @NonNull String str4, @Nullable String str5) throws l {
        int responseCode;
        d o2;
        if (!this.d.b()) {
            throw new l("Firebase Installations Service is unavailable. Please try again later.", l.a.UNAVAILABLE);
        }
        URL h2 = h(String.format(j, str3));
        for (int i2 = 0; i2 <= 1; i2++) {
            TrafficStats.setThreadStatsTag(f);
            HttpURLConnection m2 = m(h2, str);
            try {
                try {
                    m2.setRequestMethod("POST");
                    m2.setDoOutput(true);
                    if (str5 != null) {
                        m2.addRequestProperty(z, str5);
                    }
                    r(m2, str2, str4);
                    responseCode = m2.getResponseCode();
                    this.d.f(responseCode);
                } catch (IOException | AssertionError unused) {
                }
                if (j(responseCode)) {
                    o2 = o(m2);
                } else {
                    l(m2, str4, str, str3);
                    if (responseCode == 429) {
                        throw new l("Firebase servers have received too many requests from this client in a short period of time. Please try again later.", l.a.TOO_MANY_REQUESTS);
                    }
                    if (responseCode < 500 || responseCode >= 600) {
                        k();
                        a.b bVar = new a.b();
                        bVar.e = d.b.BAD_CONFIG;
                        o2 = bVar.a();
                    }
                    m2.disconnect();
                    TrafficStats.clearThreadStatsTag();
                }
                m2.disconnect();
                TrafficStats.clearThreadStatsTag();
                return o2;
            } catch (Throwable th) {
                m2.disconnect();
                TrafficStats.clearThreadStatsTag();
                throw th;
            }
        }
        throw new l("Firebase Installations Service is unavailable. Please try again later.", l.a.UNAVAILABLE);
    }

    @NonNull
    public void e(@NonNull String str, @NonNull String str2, @NonNull String str3, @NonNull String str4) throws l {
        int responseCode;
        URL h2 = h(String.format(l, str3, str2));
        int i2 = 0;
        while (i2 <= 1) {
            TrafficStats.setThreadStatsTag(g);
            HttpURLConnection m2 = m(h2, str);
            try {
                m2.setRequestMethod("DELETE");
                m2.addRequestProperty(D8.d.n, "FIS_v2 " + str4);
                responseCode = m2.getResponseCode();
            } catch (IOException unused) {
            } catch (Throwable th) {
                m2.disconnect();
                TrafficStats.clearThreadStatsTag();
                throw th;
            }
            if (responseCode != 200 && responseCode != 401 && responseCode != 404) {
                l(m2, null, str, str3);
                if (responseCode != 429 && (responseCode < 500 || responseCode >= 600)) {
                    k();
                    throw new l("Bad config while trying to delete FID", l.a.BAD_CONFIG);
                }
                i2++;
                m2.disconnect();
                TrafficStats.clearThreadStatsTag();
            }
            m2.disconnect();
            TrafficStats.clearThreadStatsTag();
            return;
        }
        throw new l("Firebase Installations Service is unavailable. Please try again later.", l.a.UNAVAILABLE);
    }

    @NonNull
    public f f(@NonNull String str, @NonNull String str2, @NonNull String str3, @NonNull String str4) throws l {
        int responseCode;
        f q2;
        if (!this.d.b()) {
            throw new l("Firebase Installations Service is unavailable. Please try again later.", l.a.UNAVAILABLE);
        }
        URL h2 = h(String.format(k, str3, str2));
        for (int i2 = 0; i2 <= 1; i2++) {
            TrafficStats.setThreadStatsTag(h);
            HttpURLConnection m2 = m(h2, str);
            try {
                try {
                    m2.setRequestMethod("POST");
                    m2.addRequestProperty(D8.d.n, "FIS_v2 " + str4);
                    m2.setDoOutput(true);
                    s(m2);
                    responseCode = m2.getResponseCode();
                    this.d.f(responseCode);
                } finally {
                    m2.disconnect();
                    TrafficStats.clearThreadStatsTag();
                }
            } catch (IOException | AssertionError unused) {
            }
            if (j(responseCode)) {
                q2 = q(m2);
            } else {
                l(m2, null, str, str3);
                if (responseCode == 401 || responseCode == 404) {
                    b.C0023b c0023b = (b.C0023b) f.a();
                    c0023b.c = f.b.AUTH_ERROR;
                    q2 = c0023b.a();
                } else {
                    if (responseCode == 429) {
                        throw new l("Firebase servers have received too many requests from this client in a short period of time. Please try again later.", l.a.TOO_MANY_REQUESTS);
                    }
                    if (responseCode < 500 || responseCode >= 600) {
                        k();
                        b.C0023b c0023b2 = (b.C0023b) f.a();
                        c0023b2.c = f.b.BAD_CONFIG;
                        q2 = c0023b2.a();
                    }
                }
            }
            return q2;
        }
        throw new l("Firebase Installations Service is unavailable. Please try again later.", l.a.UNAVAILABLE);
    }

    public final String g() {
        try {
            Context context = this.b;
            byte[] packageCertificateHashBytes = AndroidUtilsLight.getPackageCertificateHashBytes(context, context.getPackageName());
            if (packageCertificateHashBytes != null) {
                return Hex.bytesToStringUppercase(packageCertificateHashBytes, false);
            }
            Log.e("ContentValues", "Could not get fingerprint hash for package: " + this.b.getPackageName());
            return null;
        } catch (PackageManager.NameNotFoundException e2) {
            Log.e("ContentValues", "No such package: " + this.b.getPackageName(), e2);
            return null;
        }
    }

    public final URL h(String str) throws l {
        try {
            return new URL(String.format("https://%s/%s/%s", i, m, str));
        } catch (MalformedURLException e2) {
            throw new l(e2.getMessage(), l.a.UNAVAILABLE);
        }
    }

    public final HttpURLConnection m(URL url, String str) throws l {
        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", s);
            httpURLConnection.addRequestProperty("Cache-Control", u);
            httpURLConnection.addRequestProperty("X-Android-Package", this.b.getPackageName());
            j jVar = this.c.get();
            if (jVar != null) {
                try {
                    httpURLConnection.addRequestProperty(w, (String) Tasks.await(jVar.a()));
                } catch (InterruptedException e2) {
                    Thread.currentThread().interrupt();
                    Log.w("ContentValues", "Failed to get heartbeats header", e2);
                } catch (ExecutionException e3) {
                    Log.w("ContentValues", "Failed to get heartbeats header", e3);
                }
            }
            httpURLConnection.addRequestProperty("X-Android-Cert", g());
            httpURLConnection.addRequestProperty(A, str);
            return httpURLConnection;
        } catch (IOException unused) {
            throw new l("Firebase Installations Service is unavailable. Please try again later.", l.a.UNAVAILABLE);
        }
    }

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

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

    public final void r(HttpURLConnection httpURLConnection, @Nullable String str, @NonNull String str2) throws IOException {
        t(httpURLConnection, b(str, str2).toString().getBytes("UTF-8"));
    }

    public final void s(HttpURLConnection httpURLConnection) throws IOException {
        t(httpURLConnection, c().toString().getBytes("UTF-8"));
    }
}