MD5 校验值:52ffe34fa08a87a6cc4bc36d7eb3dad1
c.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package ci; 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 bm.g0; import bm.l; import com.google.firebase.installations.FirebaseInstallationsException; import com.google.firebase.messaging.FirebaseMessagingService; 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 kf.j; import org.json.JSONException; import org.json.JSONObject; import wh.h; public final class c { public static final Pattern f7634d = Pattern.compile("[0-9]+s"); public static final Charset f7635e = Charset.forName("UTF-8"); public final Context f7636a; public final yh.b<h> f7637b; public final e f7638c = new e(); public c(Context context, yh.b<h> bVar) { this.f7636a = context; this.f7637b = bVar; } public static URL a(String str) throws FirebaseInstallationsException { try { return new URL(String.format("https://%s/%s/%s", "firebaseinstallations.googleapis.com", "v1", str)); } catch (MalformedURLException e10) { throw new FirebaseInstallationsException(e10.getMessage()); } } public static void b(HttpURLConnection httpURLConnection, String str, String str2, String str3) { String a8; InputStream errorStream = httpURLConnection.getErrorStream(); String str4 = null; if (errorStream != null) { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(errorStream, f7635e)); try { StringBuilder sb2 = new StringBuilder(); while (true) { String readLine = bufferedReader.readLine(); if (readLine == null) { break; } sb2.append(readLine); sb2.append('\n'); } str4 = String.format("Error when communicating with the Firebase Installations server API. HTTP response: [%d %s: %s]", Integer.valueOf(httpURLConnection.getResponseCode()), httpURLConnection.getResponseMessage(), sb2); } catch (IOException unused) { } catch (Throwable th2) { try { bufferedReader.close(); } catch (IOException unused2) { } throw th2; } try { bufferedReader.close(); } catch (IOException unused3) { } } if (!TextUtils.isEmpty(str4)) { Log.w("Firebase-Installations", str4); Object[] objArr = new Object[3]; objArr[0] = str2; objArr[1] = str3; if (TextUtils.isEmpty(str)) { a8 = ""; } else { a8 = l.a(", ", str); } objArr[2] = a8; 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) { j.b(f7634d.matcher(str).matches(), "Invalid Expiration Timestamp."); if (str != null && str.length() != 0) { return Long.parseLong(str.substring(0, str.length() - 1)); } return 0L; } public static a e(HttpURLConnection httpURLConnection) throws AssertionError, IOException { String str; InputStream inputStream = httpURLConnection.getInputStream(); JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f7635e)); Long l10 = 0L; jsonReader.beginObject(); String str2 = null; String str3 = null; String str4 = null; String str5 = null; b bVar = null; while (jsonReader.hasNext()) { String nextName = jsonReader.nextName(); if (nextName.equals("name")) { str3 = jsonReader.nextString(); } else if (nextName.equals("fid")) { str4 = jsonReader.nextString(); } else if (nextName.equals("refreshToken")) { str5 = jsonReader.nextString(); } else if (nextName.equals("authToken")) { jsonReader.beginObject(); while (jsonReader.hasNext()) { String nextName2 = jsonReader.nextName(); if (nextName2.equals(FirebaseMessagingService.EXTRA_TOKEN)) { str2 = jsonReader.nextString(); } else if (nextName2.equals("expiresIn")) { l10 = Long.valueOf(d(jsonReader.nextString())); } else { jsonReader.skipValue(); } } if (l10 == null) { str = " tokenExpirationTimestamp"; } else { str = ""; } if (str.isEmpty()) { bVar = new b(str2, l10.longValue(), 0); jsonReader.endObject(); } else { throw new IllegalStateException(l.a("Missing required properties:", str)); } } else { jsonReader.skipValue(); } } jsonReader.endObject(); jsonReader.close(); inputStream.close(); return new a(str3, str4, str5, bVar, 1); } public static b f(HttpURLConnection httpURLConnection) throws AssertionError, IOException { String str; InputStream inputStream = httpURLConnection.getInputStream(); JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f7635e)); String str2 = null; Long l10 = 0L; jsonReader.beginObject(); while (jsonReader.hasNext()) { String nextName = jsonReader.nextName(); if (nextName.equals(FirebaseMessagingService.EXTRA_TOKEN)) { str2 = jsonReader.nextString(); } else if (nextName.equals("expiresIn")) { l10 = Long.valueOf(d(jsonReader.nextString())); } else { jsonReader.skipValue(); } } jsonReader.endObject(); jsonReader.close(); inputStream.close(); if (l10 == null) { str = " tokenExpirationTimestamp"; } else { str = ""; } if (str.isEmpty()) { return new b(str2, l10.longValue(), 1); } throw new IllegalStateException(l.a("Missing required properties:", str)); } public static void g(HttpURLConnection httpURLConnection, String str, String str2) throws IOException { try { JSONObject jSONObject = new JSONObject(); jSONObject.put("fid", str); jSONObject.put("appId", str2); jSONObject.put("authVersion", "FIS_v2"); jSONObject.put("sdkVersion", "a:17.1.0"); i(httpURLConnection, jSONObject.toString().getBytes("UTF-8")); } catch (JSONException e10) { throw new IllegalStateException(e10); } } public static void h(HttpURLConnection httpURLConnection) throws IOException { try { JSONObject jSONObject = new JSONObject(); jSONObject.put("sdkVersion", "a:17.1.0"); JSONObject jSONObject2 = new JSONObject(); jSONObject2.put("installation", jSONObject); i(httpURLConnection, jSONObject2.toString().getBytes("UTF-8")); } catch (JSONException e10) { throw new IllegalStateException(e10); } } public static void i(URLConnection uRLConnection, byte[] bArr) throws IOException { OutputStream outputStream = uRLConnection.getOutputStream(); if (outputStream != null) { GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(outputStream); try { gZIPOutputStream.write(bArr); try { return; } catch (IOException unused) { return; } } finally { try { gZIPOutputStream.close(); outputStream.close(); } catch (IOException unused2) { } } } throw new IOException("Cannot send request to FIS servers. No OutputStream available."); } public final HttpURLConnection c(URL url, String str) throws FirebaseInstallationsException { PackageInfo b10; Signature[] signatureArr; byte[] bArr; 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"); httpURLConnection.addRequestProperty("X-Android-Package", this.f7636a.getPackageName()); h hVar = this.f7637b.get(); if (hVar != null) { try { httpURLConnection.addRequestProperty("x-firebase-client", (String) tg.j.a(hVar.a())); } catch (InterruptedException e10) { Thread.currentThread().interrupt(); Log.w("ContentValues", "Failed to get heartbeats header", e10); } catch (ExecutionException e11) { Log.w("ContentValues", "Failed to get heartbeats header", e11); } } String str2 = null; try { Context context = this.f7636a; b10 = qf.d.a(context).b(64, context.getPackageName()); signatureArr = b10.signatures; } catch (PackageManager.NameNotFoundException e12) { StringBuilder b11 = android.support.v4.media.d.b("No such package: "); b11.append(this.f7636a.getPackageName()); Log.e("ContentValues", b11.toString(), e12); } if (signatureArr != null && signatureArr.length == 1) { int i10 = 0; while (true) { if (i10 < 2) { try { messageDigest = MessageDigest.getInstance("SHA1"); } catch (NoSuchAlgorithmException unused) { } if (messageDigest != null) { break; } i10++; } else { messageDigest = null; break; } } if (messageDigest != null) { bArr = messageDigest.digest(b10.signatures[0].toByteArray()); if (bArr != null) { Log.e("ContentValues", "Could not get fingerprint hash for package: " + this.f7636a.getPackageName()); } else { int length = bArr.length; StringBuilder sb2 = new StringBuilder(length + length); for (int i11 = 0; i11 < length; i11++) { char[] cArr = g0.f4142h; sb2.append(cArr[(bArr[i11] & 240) >>> 4]); sb2.append(cArr[bArr[i11] & 15]); } str2 = sb2.toString(); } httpURLConnection.addRequestProperty("X-Android-Cert", str2); httpURLConnection.addRequestProperty("x-goog-api-key", str); return httpURLConnection; } } bArr = null; if (bArr != null) { } httpURLConnection.addRequestProperty("X-Android-Cert", str2); httpURLConnection.addRequestProperty("x-goog-api-key", str); return httpURLConnection; } catch (IOException unused2) { throw new FirebaseInstallationsException("Firebase Installations Service is unavailable. Please try again later."); } } }