Lost in The World of Succubi v版本的 MD5 值为:79a6335b1b86e8c40a9ae082e1016caa
以下内容为反编译后的 c.java 源代码,内容仅作参考
package a.c.c.s.r;
import a.c.a.b.d.l.n;
import a.c.c.p.f;
import a.c.c.s.i;
import a.c.c.s.r.b;
import a.c.c.s.r.d;
import a.c.c.s.r.f;
import a.c.c.v.g;
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 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.regex.Pattern;
import java.util.zip.GZIPOutputStream;
import org.json.JSONException;
import org.json.JSONObject;
public class c {
public static final Pattern f1709e = Pattern.compile("[0-9]+s");
public static final Charset f1710f = Charset.forName("UTF-8");
public final Context f1711a;
public final a.c.c.r.b<g> f1712b;
public final a.c.c.r.b<a.c.c.p.f> f1713c;
public final e f1714d = new e();
public c(Context context, a.c.c.r.b<g> bVar, a.c.c.r.b<a.c.c.p.f> bVar2) {
this.f1711a = context;
this.f1712b = bVar;
this.f1713c = bVar2;
}
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, f1710f));
try {
StringBuilder sb = new StringBuilder();
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
sb.append(readLine);
sb.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(), sb);
} 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;
}
Log.w("Firebase-Installations", str4);
Object[] objArr = new Object[3];
objArr[0] = str2;
objArr[1] = str3;
objArr[2] = TextUtils.isEmpty(str) ? "" : a.b.a.a.a.c(", ", str);
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) {
n.h(f1709e.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) 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 URL a(String str) throws i {
try {
return new URL(String.format("https://%s/%s/%s", "firebaseinstallations.googleapis.com", "v1", str));
} catch (MalformedURLException e2) {
throw new i(e2.getMessage(), i.a.UNAVAILABLE);
}
}
public final HttpURLConnection c(URL url, String str) throws i {
PackageInfo packageInfo;
Signature[] signatureArr;
byte[] bArr;
MessageDigest messageDigest;
f.a a2;
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.f1711a.getPackageName());
if (this.f1713c.get() != null && this.f1712b.get() != null && (a2 = this.f1713c.get().a("fire-installations-id")) != f.a.NONE) {
httpURLConnection.addRequestProperty("x-firebase-client", this.f1712b.get().a());
httpURLConnection.addRequestProperty("x-firebase-client-log-type", Integer.toString(a2.f1637b));
}
String str2 = null;
try {
packageInfo = a.c.a.b.d.p.b.a(this.f1711a).f1377a.getPackageManager().getPackageInfo(this.f1711a.getPackageName(), 64);
signatureArr = packageInfo.signatures;
} catch (PackageManager.NameNotFoundException e2) {
StringBuilder g2 = a.b.a.a.a.g("No such package: ");
g2.append(this.f1711a.getPackageName());
Log.e("ContentValues", g2.toString(), e2);
}
if (signatureArr != null && signatureArr.length == 1) {
int i = 0;
while (true) {
if (i >= 2) {
messageDigest = null;
break;
}
try {
messageDigest = MessageDigest.getInstance("SHA1");
} catch (NoSuchAlgorithmException unused) {
}
if (messageDigest != null) {
break;
}
i++;
}
if (messageDigest != null) {
bArr = messageDigest.digest(packageInfo.signatures[0].toByteArray());
if (bArr != null) {
Log.e("ContentValues", "Could not get fingerprint hash for package: " + this.f1711a.getPackageName());
} else {
int length = bArr.length;
StringBuilder sb = new StringBuilder(length + length);
for (int i2 = 0; i2 < length; i2++) {
sb.append(a.c.a.b.d.o.a.f1364a[(bArr[i2] & 240) >>> 4]);
sb.append(a.c.a.b.d.o.a.f1364a[bArr[i2] & 15]);
}
str2 = sb.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 i("Firebase Installations Service is unavailable. Please try again later.", i.a.UNAVAILABLE);
}
}
public final d e(HttpURLConnection httpURLConnection) throws AssertionError, IOException {
InputStream inputStream = httpURLConnection.getInputStream();
JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f1710f));
f.a a2 = 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("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.C0018b) a2).f1706a = jsonReader.nextString();
} else if (nextName2.equals("expiresIn")) {
a2.b(d(jsonReader.nextString()));
} else {
jsonReader.skipValue();
}
}
fVar = a2.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) throws AssertionError, IOException {
InputStream inputStream = httpURLConnection.getInputStream();
JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f1710f));
f.a a2 = f.a();
jsonReader.beginObject();
while (jsonReader.hasNext()) {
String nextName = jsonReader.nextName();
if (nextName.equals("token")) {
((b.C0018b) a2).f1706a = jsonReader.nextString();
} else if (nextName.equals("expiresIn")) {
a2.b(d(jsonReader.nextString()));
} else {
jsonReader.skipValue();
}
}
jsonReader.endObject();
jsonReader.close();
inputStream.close();
b.C0018b c0018b = (b.C0018b) a2;
c0018b.f1708c = f.b.OK;
return c0018b.a();
}
public final 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.0.0");
i(httpURLConnection, jSONObject.toString().getBytes("UTF-8"));
} catch (JSONException e2) {
throw new IllegalStateException(e2);
}
}
public final void h(HttpURLConnection httpURLConnection) throws IOException {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("sdkVersion", "a:17.0.0");
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("installation", jSONObject);
i(httpURLConnection, jSONObject2.toString().getBytes("UTF-8"));
} catch (JSONException e2) {
throw new IllegalStateException(e2);
}
}
}