360 Wi-Fi v1.0.1版本的 MD5 值为:53dc85b63eb655b13344ce30ddaccae2
以下内容为反编译后的 iiLli.java 源代码,内容仅作参考
package LLliIIlIII;
import Li.llLLiiL;
import android.content.Context;
import android.content.pm.PackageManager;
import android.text.TextUtils;
import android.util.JsonReader;
import android.util.Log;
import com.anythink.expressad.videocommon.e.b;
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 com.mbridge.msdk.mbbid.out.BidResponsed;
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 org.json.JSONException;
import org.json.JSONObject;
public final class iiLli {
public static final Pattern IilIL = Pattern.compile("[0-9]+s");
public static final Charset lIlILilLLLlIi = Charset.forName("UTF-8");
public final lliiLlIl.iiLli IiiLIIlLiLLlLL;
public final Context f940iL;
public final i f941lLi = new i();
public iiLli(Context context, lliiLlIl.iiLli iilli) {
this.f940iL = context;
this.IiiLIIlLiLLlLL = iilli;
}
public static void IiiLIIlLiLLlLL(HttpURLConnection httpURLConnection, String str, String str2, String str3) {
String IllLLLIil;
InputStream errorStream = httpURLConnection.getErrorStream();
String str4 = null;
if (errorStream != null) {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(errorStream, lIlILilLLLlIi));
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)) {
Log.w("Firebase-Installations", str4);
Object[] objArr = new Object[3];
objArr[0] = str2;
objArr[1] = str3;
if (TextUtils.isEmpty(str)) {
IllLLLIil = "";
} else {
IllLLLIil = IILiIILllIilI.lliIllIlLlL.IllLLLIil(", ", str);
}
objArr[2] = IllLLLIil;
Log.w("Firebase-Installations", String.format("Firebase options used while communicating with Firebase server APIs: %s, %s%s", objArr));
}
}
public static long IilIL(String str) {
Preconditions.checkArgument(IilIL.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 IililiIiIlliL IllLl(HttpURLConnection httpURLConnection) {
InputStream inputStream = httpURLConnection.getInputStream();
JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, lIlILilLLLlIi));
llLLiiL iL2 = IililiIiIlliL.iL();
jsonReader.beginObject();
while (jsonReader.hasNext()) {
String nextName = jsonReader.nextName();
if (nextName.equals(BidResponsed.KEY_TOKEN)) {
iL2.Liil = jsonReader.nextString();
} else if (nextName.equals("expiresIn")) {
iL2.IIll = Long.valueOf(IilIL(jsonReader.nextString()));
} else {
jsonReader.skipValue();
}
}
jsonReader.endObject();
jsonReader.close();
inputStream.close();
iL2.IILiliI = lliIllIlLlL.OK;
return iL2.IiILLLILLilLl();
}
public static void LIiIl(HttpURLConnection httpURLConnection) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("sdkVersion", "a:17.1.4");
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("installation", jSONObject);
iiilLllli(httpURLConnection, jSONObject2.toString().getBytes("UTF-8"));
} catch (JSONException e) {
throw new IllegalStateException(e);
}
}
public static URL iL(String str) {
try {
return new URL(String.format("https://%s/%s/%s", "firebaseinstallations.googleapis.com", "v1", str));
} catch (MalformedURLException e) {
throw new iIiiiiiiLI.lliIllIlLlL(e.getMessage());
}
}
public static void iiiIil(HttpURLConnection httpURLConnection, String str, String str2) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("fid", str);
jSONObject.put(b.u, str2);
jSONObject.put("authVersion", "FIS_v2");
jSONObject.put("sdkVersion", "a:17.1.4");
iiilLllli(httpURLConnection, jSONObject.toString().getBytes("UTF-8"));
} catch (JSONException e) {
throw new IllegalStateException(e);
}
}
public static void iiilLllli(URLConnection uRLConnection, byte[] bArr) {
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 static LLIIliLLlIL lIlILilLLLlIi(HttpURLConnection httpURLConnection) {
InputStream inputStream = httpURLConnection.getInputStream();
JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, lIlILilLLLlIi));
llLLiiL iL2 = IililiIiIlliL.iL();
jsonReader.beginObject();
String str = null;
String str2 = null;
String str3 = null;
IililiIiIlliL iililiIiIlliL = 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(BidResponsed.KEY_TOKEN)) {
iL2.Liil = jsonReader.nextString();
} else if (nextName2.equals("expiresIn")) {
iL2.IIll = Long.valueOf(IilIL(jsonReader.nextString()));
} else {
jsonReader.skipValue();
}
}
iililiIiIlliL = iL2.IiILLLILLilLl();
jsonReader.endObject();
} else {
jsonReader.skipValue();
}
}
jsonReader.endObject();
jsonReader.close();
inputStream.close();
return new LLIIliLLlIL(str, str2, str3, iililiIiIlliL, Il.OK);
}
public final HttpURLConnection lLi(URL url, String str) {
String str2;
byte[] packageCertificateHashBytes;
try {
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setConnectTimeout(10000);
httpURLConnection.setUseCaches(false);
httpURLConnection.setReadTimeout(10000);
httpURLConnection.addRequestProperty(com.anythink.expressad.foundation.g.f.g.b.a, "application/json");
httpURLConnection.addRequestProperty("Accept", "application/json");
httpURLConnection.addRequestProperty("Content-Encoding", com.anythink.expressad.foundation.g.f.g.b.d);
httpURLConnection.addRequestProperty("Cache-Control", "no-cache");
Context context = this.f940iL;
httpURLConnection.addRequestProperty("X-Android-Package", context.getPackageName());
Iii.lliIllIlLlL lliillillll = (Iii.lliIllIlLlL) this.IiiLIIlLiLLlLL.get();
if (lliillillll != null) {
try {
httpURLConnection.addRequestProperty("x-firebase-client", (String) Tasks.await(((Iii.Il) lliillillll).iL()));
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
Log.w("ContentValues", "Failed to get heartbeats header", e);
} catch (ExecutionException e2) {
Log.w("ContentValues", "Failed to get heartbeats header", e2);
}
}
try {
packageCertificateHashBytes = AndroidUtilsLight.getPackageCertificateHashBytes(context, context.getPackageName());
} catch (PackageManager.NameNotFoundException e3) {
Log.e("ContentValues", "No such package: " + context.getPackageName(), e3);
}
if (packageCertificateHashBytes == null) {
Log.e("ContentValues", "Could not get fingerprint hash for package: " + context.getPackageName());
str2 = null;
httpURLConnection.addRequestProperty("X-Android-Cert", str2);
httpURLConnection.addRequestProperty("x-goog-api-key", str);
return httpURLConnection;
}
str2 = Hex.bytesToStringUppercase(packageCertificateHashBytes, false);
httpURLConnection.addRequestProperty("X-Android-Cert", str2);
httpURLConnection.addRequestProperty("x-goog-api-key", str);
return httpURLConnection;
} catch (IOException unused) {
throw new iIiiiiiiLI.lliIllIlLlL("Firebase Installations Service is unavailable. Please try again later.");
}
}
}