正在查看: Share Any v2.1.7 应用的 c.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Share Any v2.1.7 应用的 c.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package c9;
import android.content.Context;
import android.content.pm.PackageManager;
import android.text.TextUtils;
import android.util.JsonReader;
import c9.b;
import c9.d;
import c9.f;
import com.adjust.sdk.Constants;
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.common.util.VisibleForTesting;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
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;
public class c {
public static final Pattern f3651d = Pattern.compile("[0-9]+s");
public static final Charset f3652e = Charset.forName(Constants.ENCODING);
public final Context f3653a;
public final y8.a<x8.f> f3654b;
public final e f3655c = new e();
public c(Context context, y8.a<x8.f> aVar) {
this.f3653a = context;
this.f3654b = aVar;
}
public static void b(HttpURLConnection httpURLConnection, String str, String str2, String str3) {
InputStream errorStream = httpURLConnection.getErrorStream();
String str4 = null;
if (errorStream != null) {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(errorStream, f3652e));
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 th) {
try {
bufferedReader.close();
} catch (IOException unused2) {
}
throw th;
}
try {
bufferedReader.close();
} catch (IOException unused3) {
}
}
if (TextUtils.isEmpty(str4)) {
return;
}
Object[] objArr = new Object[3];
objArr[0] = str2;
objArr[1] = str3;
objArr[2] = TextUtils.isEmpty(str) ? "" : a.e.a(", ", str);
String.format("Firebase options used while communicating with Firebase server APIs: %s, %s%s", objArr);
}
@VisibleForTesting
public static long d(String str) {
Preconditions.checkArgument(f3651d.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 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 URL a(String str) {
try {
return new URL(String.format("https://%s/%s/%s", "firebaseinstallations.googleapis.com", "v1", str));
} catch (MalformedURLException e10) {
throw new z8.d(e10.getMessage(), 2);
}
}
public final HttpURLConnection c(URL url, String str) {
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.f3653a.getPackageName());
x8.f fVar = this.f3654b.get();
if (fVar != null) {
try {
httpURLConnection.addRequestProperty("x-firebase-client", (String) Tasks.await(fVar.a()));
} catch (InterruptedException unused) {
Thread.currentThread().interrupt();
} catch (ExecutionException unused2) {
}
}
String str2 = null;
try {
Context context = this.f3653a;
byte[] packageCertificateHashBytes = AndroidUtilsLight.getPackageCertificateHashBytes(context, context.getPackageName());
if (packageCertificateHashBytes == null) {
this.f3653a.getPackageName();
} else {
str2 = Hex.bytesToStringUppercase(packageCertificateHashBytes, false);
}
} catch (PackageManager.NameNotFoundException unused3) {
this.f3653a.getPackageName();
}
httpURLConnection.addRequestProperty("X-Android-Cert", str2);
httpURLConnection.addRequestProperty("x-goog-api-key", str);
return httpURLConnection;
} catch (IOException unused4) {
throw new z8.d("Firebase Installations Service is unavailable. Please try again later.", 2);
}
}
public final d e(HttpURLConnection httpURLConnection) {
InputStream inputStream = httpURLConnection.getInputStream();
JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f3652e));
f.a a10 = f.a();
jsonReader.beginObject();
String str = null;
String str2 = null;
String str3 = null;
f fVar = null;
while (jsonReader.hasNext()) {
String nextName = jsonReader.nextName();
if (nextName.equals(AppMeasurementSdk.ConditionalUserProperty.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")) {
((b.C0048b) a10).f3648a = jsonReader.nextString();
} else if (nextName2.equals("expiresIn")) {
a10.b(d(jsonReader.nextString()));
} else {
jsonReader.skipValue();
}
}
fVar = a10.a();
jsonReader.endObject();
} else {
jsonReader.skipValue();
}
}
jsonReader.endObject();
jsonReader.close();
inputStream.close();
return new a(str, str2, str3, fVar, d.a.OK, null);
}
public final f f(HttpURLConnection httpURLConnection) {
InputStream inputStream = httpURLConnection.getInputStream();
JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f3652e));
f.a a10 = f.a();
jsonReader.beginObject();
while (jsonReader.hasNext()) {
String nextName = jsonReader.nextName();
if (nextName.equals("token")) {
((b.C0048b) a10).f3648a = jsonReader.nextString();
} else if (nextName.equals("expiresIn")) {
a10.b(d(jsonReader.nextString()));
} else {
jsonReader.skipValue();
}
}
jsonReader.endObject();
jsonReader.close();
inputStream.close();
b.C0048b c0048b = (b.C0048b) a10;
c0048b.f3650c = f.b.OK;
return c0048b.a();
}
public final void g(HttpURLConnection httpURLConnection, String str, String str2) {
try {
je.c cVar = new je.c();
cVar.A("fid", str);
cVar.A("appId", str2);
cVar.A("authVersion", "FIS_v2");
cVar.A("sdkVersion", "a:17.2.0");
i(httpURLConnection, cVar.toString().getBytes(Constants.ENCODING));
} catch (je.b e10) {
throw new IllegalStateException((Throwable) e10);
}
}
public final void h(HttpURLConnection httpURLConnection) {
try {
je.c cVar = new je.c();
cVar.A("sdkVersion", "a:17.2.0");
je.c cVar2 = new je.c();
cVar2.A("installation", cVar);
i(httpURLConnection, cVar2.toString().getBytes(Constants.ENCODING));
} catch (je.b e10) {
throw new IllegalStateException((Throwable) e10);
}
}
}