MD5 校验值:19a22485e587e3f03a611c8471656253
b0.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package athena; import android.support.v4.media.session.PlaybackStateCompat; import android.text.TextUtils; import android.util.Base64; import android.util.Log; import android.util.Pair; import androidx.browser.trusted.sharing.ShareTarget; import androidx.exifinterface.media.ExifInterface; import athena.j0; import com.bumptech.glide.load.Key; import com.google.common.net.HttpHeaders; import com.transsion.athena.config.data.model.TidConfigBean; import com.transsion.core.CoreUtil; import com.transsion.gslb.GslbSdk; import com.transsion.sdk.oneid.crypto.crypter.RsaEcsPKCS1Encrypter; import io.appmetrica.analytics.AppMetricaDefaultValues; import io.appmetrica.analytics.coreutils.internal.StringUtils; import io.appmetrica.analytics.networktasks.internal.CommonUrlParts; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.RandomAccessFile; import java.net.HttpURLConnection; import java.net.URL; import java.net.UnknownHostException; import java.nio.channels.FileChannel; import java.nio.channels.FileLock; import java.nio.charset.Charset; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.regex.Pattern; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; import javax.crypto.KeyGenerator; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocketFactory; import org.json.JSONObject; public class b0 { private static SSLSocketFactory f6a; public static final int b = 0; static class a implements Comparator<File> { a() { } @Override public int compare(File file, File file2) { File file3 = file; File file4 = file2; if (file3.lastModified() < file4.lastModified()) { return -1; } return file3.lastModified() == file4.lastModified() ? 0 : 1; } } static class b implements Comparator<File> { b() { } @Override public int compare(File file, File file2) { return file.getName().compareTo(file2.getName()); } } static { Pattern.compile("\\d+"); f6a = null; } public static void a(String str) { File file = new File(str); a(file); if (file.isDirectory()) { if (file.listFiles() == null || file.listFiles().length == 0) { Log.d("Athena", "deleteDir " + file.getName() + " " + file.delete()); } } } public static boolean b(File file) { RandomAccessFile randomAccessFile; FileChannel fileChannel; if (file == null) { return true; } if (file.getParent().contains(CoreUtil.getContext().getFilesDir().getPath())) { File file2 = new File(file.getParent() + File.separator + System.currentTimeMillis()); if (file.renameTo(file2)) { n0.f30a.i(String.format(Locale.getDefault(), "rename to %s success", file.getName())); } return file2.delete(); } FileLock fileLock = null; try { randomAccessFile = new RandomAccessFile(file.getPath(), "rw"); try { fileChannel = randomAccessFile.getChannel(); try { try { fileLock = fileChannel.lock(); File file3 = new File(file.getParent() + File.separator + System.currentTimeMillis()); if (file.renameTo(file3)) { n0.f30a.i(String.format(Locale.getDefault(), "rename to %s success", file.getName())); } boolean delete = file3.delete(); if (fileLock != null) { try { fileLock.release(); } catch (IOException unused) { n0.f30a.i("File to release file lock"); } } try { fileChannel.close(); } catch (IOException unused2) { n0.f30a.i("File to release file channel"); } try { randomAccessFile.close(); } catch (IOException unused3) { n0.f30a.i("File to release file RandomAccessFile"); } return delete; } catch (Exception e) { e = e; n0.f30a.i("复制单个文件操作出错"); n0.f30a.e(Log.getStackTraceString(e)); if (fileLock != null) { try { fileLock.release(); } catch (IOException unused4) { n0.f30a.i("File to release file lock"); } } if (fileChannel != null) { try { fileChannel.close(); } catch (IOException unused5) { n0.f30a.i("File to release file channel"); } } if (randomAccessFile != null) { try { randomAccessFile.close(); } catch (IOException unused6) { n0.f30a.i("File to release file RandomAccessFile"); } } return false; } } catch (Throwable th) { th = th; if (fileLock != null) { try { fileLock.release(); } catch (IOException unused7) { n0.f30a.i("File to release file lock"); } } if (fileChannel != null) { try { fileChannel.close(); } catch (IOException unused8) { n0.f30a.i("File to release file channel"); } } if (randomAccessFile == null) { try { randomAccessFile.close(); throw th; } catch (IOException unused9) { n0.f30a.i("File to release file RandomAccessFile"); throw th; } } throw th; } } catch (Exception e2) { e = e2; fileChannel = null; } catch (Throwable th2) { th = th2; fileChannel = null; if (fileLock != null) { } if (fileChannel != null) { } if (randomAccessFile == null) { } } } catch (Exception e3) { e = e3; randomAccessFile = null; fileChannel = null; } catch (Throwable th3) { th = th3; randomAccessFile = null; fileChannel = null; } } public static List<File> c(String str) { List<File> a2 = a(str, new ArrayList(), (String) null); if (a2 != null && a2.size() > 0) { try { Collections.sort(a2, new a()); } catch (Exception e) { n0.f30a.e(Log.getStackTraceString(e)); } } return a2; } private static void a(File file) { if (file.exists() && file.isDirectory() && file.listFiles() != null) { for (File file2 : file.listFiles()) { if (file2.isFile()) { b(file2); } else if (file2.isDirectory()) { a(file2); } } } } public static List<File> a(String str, long j) { List<File> a2 = a(str, new ArrayList(), String.valueOf(j)); if (a2 != null && a2.size() > 0) { Collections.sort(a2, new b()); } return a2; } private static byte[] c(byte[] bArr) { GZIPInputStream gZIPInputStream; GZIPInputStream gZIPInputStream2 = null; if (bArr == null || bArr.length == 0) { return null; } ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try { gZIPInputStream = new GZIPInputStream(new ByteArrayInputStream(bArr)); try { try { byte[] bArr2 = new byte[1024]; while (true) { int read = gZIPInputStream.read(bArr2); if (read < 0) { break; } byteArrayOutputStream.write(bArr2, 0, read); } byte[] byteArray = byteArrayOutputStream.toByteArray(); try { byteArrayOutputStream.close(); gZIPInputStream.close(); } catch (Exception e) { n0.f30a.e(Log.getStackTraceString(e)); } return byteArray; } catch (Exception e2) { e = e2; n0.f30a.e(Log.getStackTraceString(e)); try { byteArrayOutputStream.close(); if (gZIPInputStream != null) { gZIPInputStream.close(); } } catch (Exception e3) { n0.f30a.e(Log.getStackTraceString(e3)); } return null; } } catch (Throwable th) { th = th; gZIPInputStream2 = gZIPInputStream; try { byteArrayOutputStream.close(); if (gZIPInputStream2 != null) { gZIPInputStream2.close(); } } catch (Exception e4) { n0.f30a.e(Log.getStackTraceString(e4)); } throw th; } } catch (Exception e5) { e = e5; gZIPInputStream = null; } catch (Throwable th2) { th = th2; byteArrayOutputStream.close(); if (gZIPInputStream2 != null) { } throw th; } } public static List<File> a(String str, List<File> list, String str2) { File[] listFiles; if (str == null) { return list; } File file = new File(str); if (!file.isDirectory() || (listFiles = file.listFiles()) == null) { return list; } for (File file2 : listFiles) { if (file2.isDirectory()) { a(file2.getAbsolutePath(), list, str2); } else if (str2 == null) { list.add(file2); } else if (file2.getName().contains(str2)) { list.add(file2); } } return list; } public static g0<String> a(String str, String str2, long j) { r rVar; String str3; URL url; HttpURLConnection httpURLConnection; String str4; g0<String> g0Var; SSLContext a2; HttpURLConnection httpURLConnection2 = null; g0<String> g0Var2 = new g0<>(-1, null); try { try { KeyGenerator keyGenerator = KeyGenerator.getInstance("AES"); keyGenerator.init(128); String a3 = com.transsion.athena.config.data.model.c.a(keyGenerator.generateKey().getEncoded()); rVar = new r(a3.getBytes()); byte[] a4 = rVar.a(str2); try { String str5 = i.f13a; str3 = Base64.encodeToString(a4, 2) + StringUtils.COMMA + Base64.encodeToString(new RsaEcsPKCS1Encrypter("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArNrm4jErOdstd1P5L1X/\nCGSS6NKf4glPrFbTM97aE9ZKGUiMALIV8W7FClAgLZdtTZkL5XEQdbX4RB/C6edc\nnN2ifla6sVu23y78FMiL6smp9ayE7Y3gSEfB3md4nvEUpyRUu4wYLIf9nVR36okK\nGCerxYdLtDbJ69Rux4lgE5C9a6qLfV6BzjJYONk/vQhGQYT6qes+TFtXV0hvF8UM\nDG+0GfA3MiQue/Ny8uIPBykDPS1dcIADzVos2fXs/o2aFTrkdVjiX8irwYBze69K\nzFx18H12iZ9gG1VztMbHetvImBoXeCOwjTc5RnGIz+Hya96pxJLK2DcSlAaHEs1H\nOQIDAQAB").encrypt(a3), 2); url = new URL(GslbSdk.getDomain(str, true)); httpURLConnection = (HttpURLConnection) url.openConnection(); } catch (Exception e) { e = e; httpURLConnection2 = null; } } catch (Throwable th) { th = th; } } catch (Exception e2) { e = e2; } try { if (httpURLConnection instanceof HttpsURLConnection) { if (f6a == null && (a2 = u.a()) != null) { f6a = a2.getSocketFactory(); } SSLSocketFactory sSLSocketFactory = f6a; if (sSLSocketFactory != null) { ((HttpsURLConnection) httpURLConnection).setSSLSocketFactory(sSLSocketFactory); ((HttpsURLConnection) httpURLConnection).setHostnameVerifier(u.f39a); } } httpURLConnection.setRequestProperty("accept", "*/*"); httpURLConnection.setRequestProperty(HttpHeaders.CONTENT_LENGTH, String.valueOf(str3.length())); httpURLConnection.setRequestProperty("encrypt-level", ExifInterface.GPS_MEASUREMENT_2D); httpURLConnection.setRequestProperty("ver", String.valueOf(j)); httpURLConnection.setRequestProperty("vn", "1"); httpURLConnection.setRequestMethod(ShareTarget.METHOD_POST); httpURLConnection.setReadTimeout(20000); httpURLConnection.setConnectTimeout(30000); httpURLConnection.setDoInput(true); httpURLConnection.setDoOutput(true); PrintWriter printWriter = new PrintWriter(httpURLConnection.getOutputStream()); printWriter.write(str3); printWriter.flush(); printWriter.close(); int responseCode = httpURLConnection.getResponseCode(); n0.f30a.i("url:" + url + " code:" + responseCode + " Post Data:" + str2 + " version:" + j); if (responseCode == 200) { InputStream inputStream = httpURLConnection.getInputStream(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName(Key.STRING_CHARSET_NAME))); StringBuilder sb = new StringBuilder(); while (true) { String readLine = bufferedReader.readLine(); if (readLine == null) { break; } sb.append(readLine); } String sb2 = sb.toString(); if (TextUtils.equals("{}", sb2)) { g0Var = new g0<>(1, null); } else if (TextUtils.isEmpty(sb2)) { g0Var = new g0<>(-1, null); } else { if (str.contains("secret")) { str4 = new String(rVar.a(Base64.decode(sb2, 2)), Charset.forName(Key.STRING_CHARSET_NAME)); } else { str4 = new String(c(rVar.a(Base64.decode(sb2, 2))), Charset.forName(Key.STRING_CHARSET_NAME)); } g0Var = new g0<>(0, str4); } g0Var2 = g0Var; bufferedReader.close(); inputStream.close(); } httpURLConnection.disconnect(); } catch (Exception e3) { e = e3; httpURLConnection2 = httpURLConnection; try { if (e instanceof UnknownHostException) { n0.f30a.e(e.getMessage()); } else { n0.f30a.e(Log.getStackTraceString(e)); } if (httpURLConnection2 != null) { httpURLConnection2.disconnect(); } return g0Var2; } catch (Throwable th2) { th = th2; if (httpURLConnection2 != null) { httpURLConnection2.disconnect(); } throw th; } } catch (Throwable th3) { th = th3; httpURLConnection2 = httpURLConnection; if (httpURLConnection2 != null) { } throw th; } return g0Var2; } public static g0<Long> b(String str) { HttpURLConnection httpURLConnection; URL url; SSLContext a2; HttpURLConnection httpURLConnection2 = null; try { try { url = new URL(str); httpURLConnection = (HttpURLConnection) url.openConnection(); } catch (Throwable th) { th = th; } } catch (Exception e) { e = e; } try { if (httpURLConnection instanceof HttpsURLConnection) { if (f6a == null && (a2 = u.a()) != null) { f6a = a2.getSocketFactory(); } SSLSocketFactory sSLSocketFactory = f6a; if (sSLSocketFactory != null) { ((HttpsURLConnection) httpURLConnection).setSSLSocketFactory(sSLSocketFactory); ((HttpsURLConnection) httpURLConnection).setHostnameVerifier(u.f39a); } } httpURLConnection.setReadTimeout(AppMetricaDefaultValues.DEFAULT_MAX_REPORTS_COUNT_UPPER_BOUND); httpURLConnection.setConnectTimeout(AppMetricaDefaultValues.DEFAULT_MAX_REPORTS_COUNT_UPPER_BOUND); int responseCode = httpURLConnection.getResponseCode(); n0.f30a.i("url:" + url); if (responseCode >= 200 && responseCode < 400) { g0<Long> g0Var = new g0<>(0, Long.valueOf(httpURLConnection.getDate())); httpURLConnection.disconnect(); return g0Var; } } catch (Exception e2) { e = e2; httpURLConnection2 = httpURLConnection; if (e instanceof UnknownHostException) { n0.f30a.e(e.getMessage()); } else { n0.f30a.e(Log.getStackTraceString(e)); } if (httpURLConnection2 != null) { httpURLConnection = httpURLConnection2; httpURLConnection.disconnect(); } return new g0<>(-1, 0L); } catch (Throwable th2) { th = th2; httpURLConnection2 = httpURLConnection; if (httpURLConnection2 != null) { httpURLConnection2.disconnect(); } throw th; } httpURLConnection.disconnect(); return new g0<>(-1, 0L); } private static String b(byte[] bArr) { try { MessageDigest messageDigest = MessageDigest.getInstance("MD5"); messageDigest.update(bArr); byte[] digest = messageDigest.digest(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < digest.length; i++) { if (Integer.toHexString(digest[i] & 255).length() == 1) { sb.append(CommonUrlParts.Values.FALSE_INTEGER); sb.append(Integer.toHexString(digest[i] & 255)); } else { sb.append(Integer.toHexString(digest[i] & 255)); } } return sb.toString(); } catch (NoSuchAlgorithmException unused) { return ""; } } public static g0<j0> a(long j, byte[] bArr, int i, com.transsion.athena.config.data.model.b bVar) { HttpURLConnection httpURLConnection; URL url; HttpURLConnection httpURLConnection2; byte[] bArr2; TidConfigBean c; SSLContext a2; g0<j0> g0Var = new g0<>(2, new j0("sdk_error")); try { url = new URL(GslbSdk.getDomain(bVar.f48a, true)); httpURLConnection2 = (HttpURLConnection) url.openConnection(); try { if (httpURLConnection2 instanceof HttpsURLConnection) { if (f6a == null && (a2 = u.a()) != null) { f6a = a2.getSocketFactory(); } SSLSocketFactory sSLSocketFactory = f6a; if (sSLSocketFactory != null) { ((HttpsURLConnection) httpURLConnection2).setSSLSocketFactory(sSLSocketFactory); ((HttpsURLConnection) httpURLConnection2).setHostnameVerifier(u.f39a); } } httpURLConnection2.setReadTimeout(20000); httpURLConnection2.setConnectTimeout(30000); httpURLConnection2.setDoOutput(true); httpURLConnection2.setUseCaches(false); httpURLConnection2.setRequestMethod(ShareTarget.METHOD_POST); httpURLConnection2.setInstanceFollowRedirects(true); if (bVar.c * PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID <= ((long) bArr.length)) { httpURLConnection2.setRequestProperty(HttpHeaders.ACCEPT_ENCODING, "gzip, deflate"); httpURLConnection2.setRequestProperty("zip", "1"); bArr2 = a(bArr); } else { httpURLConnection2.setRequestProperty(HttpHeaders.ACCEPT_ENCODING, "text/example"); httpURLConnection2.setRequestProperty("zip", CommonUrlParts.Values.FALSE_INTEGER); bArr2 = bArr; } httpURLConnection2.setRequestProperty("fixed", "1"); httpURLConnection2.setRequestProperty("record-id", j + ""); httpURLConnection2.setRequestProperty("count", i + ""); httpURLConnection2.setRequestProperty("ver", "2.3.6.1"); c = athena.b.a().c(j); } catch (Exception e) { e = e; httpURLConnection = httpURLConnection2; try { if (e instanceof UnknownHostException) { n0.f30a.e(e.getMessage()); } else { n0.f30a.e(Log.getStackTraceString(e)); } if (httpURLConnection != null) { httpURLConnection.disconnect(); } return new g0<>(-1, new j0()); } catch (Throwable th) { th = th; if (httpURLConnection != null) { httpURLConnection.disconnect(); } throw th; } } catch (Throwable th2) { th = th2; httpURLConnection = httpURLConnection2; if (httpURLConnection != null) { } throw th; } } catch (Exception e2) { e = e2; httpURLConnection = null; } catch (Throwable th3) { th = th3; httpURLConnection = null; } if (c == null) { n0.f30a.d("requestByPost TidConfigBean " + j + " is missing, maybe cancelled"); g0Var.b.e = "tid not found"; httpURLConnection2.disconnect(); return g0Var; } c.getTidConfig().getClass(); byte[] bArr3 = (byte[]) bVar.b.second; r rVar = bArr3 == null ? null : new r(bArr3); if (rVar == null) { g0Var.b.e = "encrypt error"; httpURLConnection2.disconnect(); return g0Var; } byte[] bytes = Base64.encodeToString(rVar.b(bArr2), 2).getBytes(); if (bytes == null) { n0.f30a.e("requestByPost buffer is null"); g0Var.b.e = "base64 error"; httpURLConnection2.disconnect(); return g0Var; } String b2 = b(bytes); if (TextUtils.isEmpty(b2)) { httpURLConnection2.setRequestProperty("md5", "error"); } else { httpURLConnection2.setRequestProperty("md5", b2); } httpURLConnection2.setRequestProperty("encrypt-level", ExifInterface.GPS_MEASUREMENT_3D); httpURLConnection2.setRequestProperty("encrypt-index", "" + (((Integer) bVar.b.first).intValue() + 1)); n0.f30a.i(url + " tid = " + j + " count = " + i); httpURLConnection2.connect(); DataOutputStream dataOutputStream = new DataOutputStream(httpURLConnection2.getOutputStream()); dataOutputStream.write(bytes); dataOutputStream.flush(); dataOutputStream.close(); int responseCode = httpURLConnection2.getResponseCode(); if (responseCode == 200) { String a3 = a(httpURLConnection2.getInputStream()); n0.f30a.i(String.format(Locale.ENGLISH, "post tid: %s response: %s", Long.valueOf(j), a3)); if (!TextUtils.isEmpty(a3)) { int optInt = new JSONObject(a3).optInt("code"); if (optInt == 0) { g0<j0> g0Var2 = new g0<>(0, new j0()); httpURLConnection2.disconnect(); return g0Var2; } g0<j0> g0Var3 = new g0<>(-1, new j0("rc_" + optInt)); httpURLConnection2.disconnect(); return g0Var3; } g0<j0> g0Var4 = new g0<>(-1, new j0("rc_" + i)); httpURLConnection2.disconnect(); return g0Var4; } n0.f30a.i(String.format(Locale.ENGLISH, "tid: %s response code: %d", Long.valueOf(j), Integer.valueOf(responseCode))); httpURLConnection2.disconnect(); return new g0<>(-1, new j0()); } public static g0<j0> a(String str, byte[] bArr, int i, List<Integer> list, String str2, String str3) { URL url; HttpURLConnection httpURLConnection; byte[] bArr2; Pair<Integer, byte[]> g; SSLContext a2; g0<j0> g0Var = new g0<>(2, new j0("sdk_error")); HttpURLConnection httpURLConnection2 = null; r rVar = null; HttpURLConnection httpURLConnection3 = null; try { try { url = new URL(str); httpURLConnection = (HttpURLConnection) url.openConnection(); } catch (Throwable th) { th = th; } } catch (Exception e) { e = e; } try { if (httpURLConnection instanceof HttpsURLConnection) { if (f6a == null && (a2 = u.a()) != null) { f6a = a2.getSocketFactory(); } SSLSocketFactory sSLSocketFactory = f6a; if (sSLSocketFactory != null) { ((HttpsURLConnection) httpURLConnection).setSSLSocketFactory(sSLSocketFactory); ((HttpsURLConnection) httpURLConnection).setHostnameVerifier(u.f39a); } } httpURLConnection.setReadTimeout(20000); httpURLConnection.setConnectTimeout(30000); httpURLConnection.setDoOutput(true); httpURLConnection.setUseCaches(false); httpURLConnection.setRequestMethod(ShareTarget.METHOD_POST); httpURLConnection.setInstanceFollowRedirects(true); bArr2 = bArr; if (bArr2.length > 2048) { httpURLConnection.setRequestProperty(HttpHeaders.ACCEPT_ENCODING, "gzip, deflate"); httpURLConnection.setRequestProperty("zip", "1"); bArr2 = a(bArr); } else { httpURLConnection.setRequestProperty(HttpHeaders.ACCEPT_ENCODING, "text/example"); httpURLConnection.setRequestProperty("zip", CommonUrlParts.Values.FALSE_INTEGER); } httpURLConnection.setRequestProperty("fixed", "1"); httpURLConnection.setRequestProperty("count", String.valueOf(list.size())); httpURLConnection.setRequestProperty("appids", com.transsion.athena.config.data.model.c.a(list, "_")); httpURLConnection.setRequestProperty("ver", "2.3.6.1"); httpURLConnection.setRequestProperty(CommonUrlParts.UUID, str2); httpURLConnection.setRequestProperty("dupid", str3); g = athena.b.a().g(); byte[] bArr3 = (byte[]) g.second; if (bArr3 != null) { rVar = new r(bArr3); } } catch (Exception e2) { e = e2; httpURLConnection2 = httpURLConnection; if (e instanceof UnknownHostException) { n0.f30a.e(e.getMessage()); } else { n0.f30a.e(Log.getStackTraceString(e)); } if (httpURLConnection2 != null) { httpURLConnection2.disconnect(); } return new g0<>(-1, new j0()); } catch (Throwable th2) { th = th2; httpURLConnection3 = httpURLConnection; if (httpURLConnection3 != null) { httpURLConnection3.disconnect(); } throw th; } if (rVar == null) { g0Var.b.e = "encrypt error"; httpURLConnection.disconnect(); return g0Var; } byte[] bytes = Base64.encodeToString(rVar.b(bArr2), 2).getBytes(); if (bytes == null) { n0.f30a.e("requestByPost buffer is null"); g0Var.b.e = "base64 error"; httpURLConnection.disconnect(); return g0Var; } httpURLConnection.setRequestProperty("encrypt-level", ExifInterface.GPS_MEASUREMENT_3D); httpURLConnection.setRequestProperty("encrypt-index", "" + (((Integer) g.first).intValue() + 1)); n0.f30a.i(url.toString() + " count = " + i); httpURLConnection.connect(); DataOutputStream dataOutputStream = new DataOutputStream(httpURLConnection.getOutputStream()); dataOutputStream.write(bytes); dataOutputStream.flush(); dataOutputStream.close(); int responseCode = httpURLConnection.getResponseCode(); if (responseCode == 200) { String a3 = a(httpURLConnection.getInputStream()); n0.f30a.i(String.format(Locale.ENGLISH, "post response: %s", a3)); if (!TextUtils.isEmpty(a3)) { JSONObject jSONObject = new JSONObject(a3); int optInt = jSONObject.optInt("code"); if (optInt == 0) { j0 j0Var = new j0(); JSONObject optJSONObject = jSONObject.optJSONObject("app"); if (optJSONObject != null) { Iterator<String> keys = optJSONObject.keys(); while (keys.hasNext()) { String next = keys.next(); long j = optJSONObject.getJSONObject(next).getLong("ver"); int i2 = optJSONObject.getJSONObject(next).getInt("type"); if (i2 != 0) { j0.a aVar = new j0.a(Integer.parseInt(next), i2, j); if (j0Var.c == null) { j0Var.c = new ArrayList(); } j0Var.c.add(aVar); } } } g0<j0> g0Var2 = new g0<>(0, j0Var); httpURLConnection.disconnect(); return g0Var2; } g0<j0> g0Var3 = new g0<>(-1, new j0("rc_" + optInt)); httpURLConnection.disconnect(); return g0Var3; } g0<j0> g0Var4 = new g0<>(-1, new j0("rc_" + i)); httpURLConnection.disconnect(); return g0Var4; } n0.f30a.i(String.format(Locale.ENGLISH, "response code: %d", Integer.valueOf(responseCode))); httpURLConnection.disconnect(); return new g0<>(-1, new j0()); } private static String a(InputStream inputStream) { try { StringBuilder sb = new StringBuilder(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); while (true) { String readLine = bufferedReader.readLine(); if (readLine != null) { sb.append(readLine); } else { bufferedReader.close(); inputStream.close(); return sb.toString(); } } } catch (IOException e) { n0.f30a.e(Log.getStackTraceString(e)); return null; } } private static byte[] a(byte[] bArr) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try { GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(byteArrayOutputStream); gZIPOutputStream.write(bArr); gZIPOutputStream.close(); byte[] byteArray = byteArrayOutputStream.toByteArray(); byteArrayOutputStream.close(); byteArrayOutputStream.reset(); return byteArray; } catch (Exception e) { n0.f30a.e(Log.getStackTraceString(e)); return null; } } }