正在查看: 多多分期 v4.1.2 应用的 w.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 多多分期 v4.1.2 应用的 w.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package d.s.b.b;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import com.blankj.utilcode.util.BarUtils;
import com.tencent.smtt.sdk.TbsLogReport;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.URL;
import java.util.HashSet;
import java.util.Set;
public class w {
public static int y = 5;
public static int z = 1;
public Context f9243a;
public String f9244b;
public String f9245c;
public String f9246d;
public File f9247e;
public long f9248f;
public boolean f9251i;
public int f9252j;
public int f9253k;
public boolean f9254l;
public boolean f9255m;
public HttpURLConnection f9256n;
public TbsLogReport.a o;
public String p;
public int q;
public boolean r;
public Handler s;
public Set<String> t;
public String v;
public int f9249g = 30000;
public int f9250h = 20000;
public int u = y;
public String[] w = null;
public int x = 0;
public w(Context context) {
Context applicationContext = context.getApplicationContext();
this.f9243a = applicationContext;
this.o = TbsLogReport.b(applicationContext).a();
this.t = new HashSet();
String str = "tbs_downloading_" + this.f9243a.getPackageName();
c0.j();
File l0 = c0.l0(this.f9243a);
this.f9247e = l0;
if (l0 == null) {
throw new NullPointerException("TbsCorePrivateDir is null!");
}
z();
this.p = null;
this.q = -1;
}
@TargetApi(8)
public static File b(Context context) {
try {
File file = Build.VERSION.SDK_INT >= 8 ? new File(d.s.b.c.n.b(context, 4)) : null;
if (file != null && !file.exists() && !file.isDirectory()) {
file.mkdirs();
}
return file;
} catch (Exception e2) {
e2.printStackTrace();
d.s.b.c.c.d("TbsDownload", "[TbsApkDownloader.backupApkPath] Exception is " + e2.getMessage());
return null;
}
}
public static File c(Context context, int i2) {
File file = new File(d.s.b.c.n.b(context, i2));
if (file.exists() && file.isDirectory()) {
if (new File(file, g.w(context) ? "x5.oversea.tbs.org" : "x5.tbs.org").exists()) {
return file;
}
}
return null;
}
public static void j(File file, Context context) {
File file2;
if (file == null || !file.exists()) {
return;
}
try {
File b2 = b(context);
if (b2 != null) {
if (f.i(context).f9168b.getInt("tbs_download_version_type", 0) == 1) {
file2 = new File(b2, "x5.tbs.decouple");
} else {
file2 = new File(b2, g.w(context) ? "x5.oversea.tbs.org" : "x5.tbs.org");
}
file2.delete();
d.s.b.c.n.w(file, file2);
if (f.i(context).f9168b.getInt("tbs_download_version_type", 0) == 1 || f.i(context).f9168b.getInt("tbs_decouplecoreversion", 0) != d.s.b.c.e.a(context, file)) {
return;
}
File file3 = new File(b2, "x5.tbs.decouple");
if (d.s.b.c.e.a(context, file) != d.s.b.c.e.a(context, file3)) {
file3.delete();
d.s.b.c.n.w(file, file3);
}
}
} catch (Exception unused) {
}
}
@TargetApi(8)
public static File q(Context context) {
try {
if (Build.VERSION.SDK_INT < 8) {
return null;
}
File c2 = c(context, 4);
if (c2 == null) {
c2 = c(context, 3);
}
if (c2 == null) {
c2 = c(context, 2);
}
return c2 == null ? c(context, 1) : c2;
} catch (Exception e2) {
e2.printStackTrace();
d.s.b.c.c.d("TbsDownload", "[TbsApkDownloader.backupApkPath] Exception is " + e2.getMessage());
return null;
}
}
public static void v(Context context) {
try {
c0.j();
File l0 = c0.l0(context);
new File(l0, "x5.tbs").delete();
new File(l0, "x5.tbs.temp").delete();
File b2 = b(context);
if (b2 != null) {
new File(b2, "x5.tbs.org").delete();
new File(b2, "x5.oversea.tbs.org").delete();
}
} catch (Exception unused) {
}
}
public final void A() {
TbsLogReport b2;
TbsLogReport.EventType eventType;
d.s.b.c.c.g("TbsDownload", "[TbsApkDownloader.closeHttpRequest]");
HttpURLConnection httpURLConnection = this.f9256n;
if (httpURLConnection != null) {
if (!this.f9254l) {
this.o.I(e(httpURLConnection.getURL()));
}
try {
this.f9256n.disconnect();
} catch (Throwable th) {
d.s.b.c.c.d("TbsDownload", "[closeHttpRequest] mHttpRequest.disconnect() Throwable:" + th.toString());
}
this.f9256n = null;
}
TbsLogReport.a aVar = this.o;
int i2 = aVar.p;
if (this.f9254l || !this.r) {
g.f9178h = false;
return;
}
aVar.A(System.currentTimeMillis());
String a2 = d.s.b.c.a.a(this.f9243a);
if (a2 == null) {
a2 = "";
}
int b3 = d.s.b.c.a.b(this.f9243a);
this.o.s(a2);
this.o.F(b3);
if (b3 != this.q || !a2.equals(this.p)) {
this.o.E(0);
}
int i3 = this.o.p;
if ((i3 == 0 || i3 == 107) && this.o.h() == 0 && (!d.s.b.c.a.d(this.f9243a) || !F())) {
g(101, null, true);
}
if (f.i(this.f9243a).f9168b.getInt("tbs_downloaddecouplecore", 0) == 1) {
b2 = TbsLogReport.b(this.f9243a);
eventType = TbsLogReport.EventType.TYPE_DOWNLOAD_DECOUPLE;
} else {
b2 = TbsLogReport.b(this.f9243a);
eventType = TbsLogReport.EventType.TYPE_DOWNLOAD;
}
b2.k(eventType, this.o);
this.o.r();
if (i2 != 100) {
c.A.c(i2);
}
}
public final boolean B() {
File file = new File(d.s.b.c.n.b(this.f9243a, 4), g.w(this.f9243a) ? "x5.oversea.tbs.org" : "x5.tbs.org");
int i2 = f.i(this.f9243a).f9168b.getInt("use_backup_version", 0);
if (i2 == 0) {
i2 = f.i(this.f9243a).f9168b.getInt("tbs_download_version", 0);
}
return d.s.b.c.e.d(this.f9243a, file, 0L, i2);
}
public final void C() {
try {
if (f.i(this.f9243a).f9168b.getInt("tbs_downloaddecouplecore", 0) == 1) {
return;
}
File file = new File(d.s.b.c.n.b(this.f9243a, 4), g.w(this.f9243a) ? "x5.oversea.tbs.org" : "x5.tbs.org");
if (file.exists()) {
file.delete();
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
public final boolean D() {
return new File(this.f9247e, "x5.tbs.temp").exists();
}
public final long E() {
File file = new File(this.f9247e, "x5.tbs.temp");
if (file.exists()) {
return file.length();
}
return 0L;
}
public final boolean F() {
InputStreamReader inputStreamReader;
BufferedReader bufferedReader;
Throwable th;
InputStream inputStream;
boolean z2 = false;
try {
inputStream = Runtime.getRuntime().exec("ping www.qq.com").getInputStream();
try {
inputStreamReader = new InputStreamReader(inputStream);
try {
bufferedReader = new BufferedReader(inputStreamReader);
int i2 = 0;
do {
try {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
if (readLine.contains("TTL") || readLine.contains("ttl")) {
z2 = true;
break;
}
i2++;
} catch (Throwable th2) {
th = th2;
try {
th.printStackTrace();
return z2;
} finally {
i(inputStream);
i(inputStreamReader);
i(bufferedReader);
}
}
} while (i2 < 5);
} catch (Throwable th3) {
bufferedReader = null;
th = th3;
}
} catch (Throwable th4) {
bufferedReader = null;
th = th4;
inputStreamReader = null;
}
} catch (Throwable th5) {
inputStreamReader = null;
bufferedReader = null;
th = th5;
inputStream = null;
}
return z2;
}
public final long G() {
int i2 = this.f9252j;
return (i2 == 1 || i2 == 2) ? this.f9252j * 20000 : (i2 == 3 || i2 == 4) ? 100000L : 200000L;
}
public final boolean H() {
boolean z2 = false;
boolean z3 = d.s.b.c.a.b(this.f9243a) == 3;
d.s.b.c.c.g("TbsDownload", "[TbsApkDwonloader.detectWifiNetworkAvailable] isWifi=" + z3);
String str = null;
HttpURLConnection httpURLConnection = null;
if (z3) {
String c2 = d.s.b.c.a.c(this.f9243a);
d.s.b.c.c.g("TbsDownload", "[TbsApkDwonloader.detectWifiNetworkAvailable] localBSSID=" + c2);
try {
HttpURLConnection httpURLConnection2 = (HttpURLConnection) new URL("http://pms.mb.qq.com/rsp204").openConnection();
try {
httpURLConnection2.setInstanceFollowRedirects(false);
httpURLConnection2.setConnectTimeout(10000);
httpURLConnection2.setReadTimeout(10000);
httpURLConnection2.setUseCaches(false);
httpURLConnection2.getInputStream();
int responseCode = httpURLConnection2.getResponseCode();
d.s.b.c.c.g("TbsDownload", "[TbsApkDwonloader.detectWifiNetworkAvailable] responseCode=" + responseCode);
boolean z4 = responseCode == 204;
if (httpURLConnection2 != null) {
try {
httpURLConnection2.disconnect();
} catch (Exception unused) {
}
}
str = c2;
z2 = z4;
} catch (Throwable th) {
th = th;
httpURLConnection = httpURLConnection2;
try {
th.printStackTrace();
if (httpURLConnection != null) {
try {
httpURLConnection.disconnect();
} catch (Exception unused2) {
}
}
str = c2;
if (!z2) {
this.t.add(str);
I();
this.s.sendMessageDelayed(this.s.obtainMessage(150, str), 120000L);
}
if (z2) {
this.t.remove(str);
}
return z2;
} catch (Throwable th2) {
if (httpURLConnection != null) {
try {
httpURLConnection.disconnect();
} catch (Exception unused3) {
}
}
throw th2;
}
}
} catch (Throwable th3) {
th = th3;
}
}
if (!z2 && !TextUtils.isEmpty(str) && !this.t.contains(str)) {
this.t.add(str);
I();
this.s.sendMessageDelayed(this.s.obtainMessage(150, str), 120000L);
}
if (z2 && this.t.contains(str)) {
this.t.remove(str);
}
return z2;
}
public final void I() {
if (this.s == null) {
this.s = new x(this, b0.a().getLooper());
}
}
public final long a(long j2, long j3) {
long currentTimeMillis = System.currentTimeMillis();
this.o.u(currentTimeMillis - j2);
this.o.x(j3);
return currentTimeMillis;
}
public final String d(Throwable th) {
String stackTraceString = Log.getStackTraceString(th);
return stackTraceString.length() > 1024 ? stackTraceString.substring(0, 1024) : stackTraceString;
}
public final String e(URL url) {
try {
return InetAddress.getByName(url.getHost()).getHostAddress();
} catch (Error e2) {
e2.printStackTrace();
return "";
} catch (Exception e3) {
e3.printStackTrace();
return "";
}
}
public void f(int i2) {
try {
File file = new File(this.f9247e, "x5.tbs");
int a2 = d.s.b.c.e.a(this.f9243a, file);
if (-1 == a2 || (i2 > 0 && i2 == a2)) {
file.delete();
}
} catch (Exception unused) {
}
}
public final void g(int i2, String str, boolean z2) {
if (z2 || this.f9252j > this.u) {
this.o.z(i2);
this.o.B(str);
}
}
public final void h(long j2) {
this.f9252j++;
if (j2 <= 0) {
try {
j2 = G();
} catch (Exception unused) {
return;
}
}
Thread.sleep(j2);
}
public final void i(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException unused) {
}
}
}
public final void k(String str) {
URL url = new URL(str);
HttpURLConnection httpURLConnection = this.f9256n;
if (httpURLConnection != null) {
try {
httpURLConnection.disconnect();
} catch (Throwable th) {
d.s.b.c.c.d("TbsDownload", "[initHttpRequest] mHttpRequest.disconnect() Throwable:" + th.toString());
}
}
HttpURLConnection httpURLConnection2 = (HttpURLConnection) url.openConnection();
this.f9256n = httpURLConnection2;
httpURLConnection2.setRequestProperty("User-Agent", g.c(this.f9243a));
this.f9256n.setRequestProperty("Accept-Encoding", "identity");
this.f9256n.setRequestMethod("GET");
this.f9256n.setInstanceFollowRedirects(false);
this.f9256n.setConnectTimeout(this.f9250h);
this.f9256n.setReadTimeout(this.f9249g);
}
public boolean l() {
d.s.b.c.c.g("TbsApkDownloader", "verifyAndInstallDecoupleCoreFromBackup #1");
try {
File file = new File(d.s.b.c.n.b(this.f9243a, 4), "x5.tbs.decouple");
if (file.exists()) {
d.s.b.c.c.g("TbsApkDownloader", "verifyAndInstallDecoupleCoreFromBackup #2");
} else {
File l2 = g.l(f.i(this.f9243a).f9168b.getInt("tbs_decouplecoreversion", -1));
if (l2 != null && l2.exists()) {
d.s.b.c.n.w(l2, file);
}
}
if (d.s.b.c.e.d(this.f9243a, file, 0L, f.i(this.f9243a).f9168b.getInt("tbs_decouplecoreversion", -1))) {
d.s.b.c.c.g("TbsApkDownloader", "verifyAndInstallDecoupleCoreFromBackup #3");
return c0.j().R(this.f9243a);
}
d.s.b.c.c.g("TbsApkDownloader", "verifyAndInstallDecoupleCoreFromBackup no backup file !!!");
File file2 = new File(d.s.b.c.n.b(this.f9243a, 4), "x5.tbs.decouple");
if (!file2.exists()) {
return false;
}
file2.delete();
return false;
} catch (Exception unused) {
return false;
}
}
public boolean n(boolean z2) {
String[] strArr;
int i2;
if ((z2 && !H() && (!c.r() || !d.s.b.c.a.d(this.f9243a))) || (strArr = this.w) == null || (i2 = this.x) < 0 || i2 >= strArr.length) {
return false;
}
this.x = i2 + 1;
this.f9246d = strArr[i2];
this.f9252j = 0;
this.f9253k = 0;
this.f9248f = -1L;
this.f9251i = false;
this.f9254l = false;
this.f9255m = false;
this.r = false;
return true;
}
public boolean o(boolean r9, boolean r10) {
throw new UnsupportedOperationException("Method not decompiled: d.s.b.b.w.o(boolean, boolean):boolean");
}
public int p() {
File b2 = b(this.f9243a);
if (b2 == null) {
return 0;
}
return d.s.b.c.e.a(this.f9243a, new File(b2, g.w(this.f9243a) ? "x5.oversea.tbs.org" : "x5.tbs.org"));
}
public final void r(boolean z2) {
d.s.b.c.z.b(this.f9243a);
f i2 = f.i(this.f9243a);
i2.f9167a.put("request_full_package", Boolean.FALSE);
i2.f9167a.put("tbs_needdownload", Boolean.FALSE);
i2.f9167a.put("tbs_download_interrupt_code_reason", Integer.valueOf(BarUtils.TAG_OFFSET));
i2.b();
c.A.c(z2 ? 100 : 120);
int i3 = i2.f9168b.getInt("tbs_responsecode", 0);
f.i(this.f9243a).f9168b.getInt("tbs_downloaddecouplecore", 0);
if (i3 != 3 && i3 <= 10000) {
c0.j().p(this.f9243a, new File(this.f9247e, "x5.tbs").getAbsolutePath(), i2.f9168b.getInt("tbs_download_version", 0));
j(new File(this.f9247e, "x5.tbs"), this.f9243a);
return;
}
File b2 = b(this.f9243a);
if (b2 == null) {
y();
i2.f9167a.put("tbs_needdownload", Boolean.TRUE);
i2.b();
return;
}
File file = new File(b2, g.w(this.f9243a) ? "x5.oversea.tbs.org" : "x5.tbs.org");
int a2 = d.s.b.c.e.a(this.f9243a, file);
File file2 = new File(this.f9247e, "x5.tbs");
String absolutePath = file2.exists() ? file2.getAbsolutePath() : null;
int i4 = i2.f9168b.getInt("tbs_download_version", 0);
Bundle bundle = new Bundle();
bundle.putInt("operation", i3);
bundle.putInt("old_core_ver", a2);
bundle.putInt("new_core_ver", i4);
bundle.putString("old_apk_location", file.getAbsolutePath());
bundle.putString("new_apk_location", absolutePath);
bundle.putString("diff_file_location", absolutePath);
c0.j().C(this.f9243a, bundle);
}
public void s(boolean r40, boolean r41) {
throw new UnsupportedOperationException("Method not decompiled: d.s.b.b.w.s(boolean, boolean):void");
}
public final boolean t(int i2) {
try {
File file = new File(this.f9247e, "x5.tbs");
File b2 = b(this.f9243a);
if (b2 == null) {
return false;
}
File file2 = new File(b2, g.w(this.f9243a) ? "x5.oversea.tbs.org" : "x5.tbs.org");
file.delete();
d.s.b.c.n.w(file2, file);
if (d.s.b.c.e.d(this.f9243a, file, 0L, i2)) {
return true;
}
d.s.b.c.c.g("TbsDownload", "[TbsApkDownloader.copyTbsApkFromBackupToInstall] verifyTbsApk error!!");
return false;
} catch (Exception e2) {
e2.printStackTrace();
d.s.b.c.c.d("TbsDownload", "[TbsApkDownloader.copyTbsApkFromBackupToInstall] Exception is " + e2.getMessage());
return false;
}
}
public void u() {
TbsLogReport b2;
TbsLogReport.EventType eventType;
this.f9254l = true;
if (j.C(this.f9243a)) {
TbsLogReport.a a2 = TbsLogReport.b(this.f9243a).a();
a2.z(-309);
a2.C(new Exception());
if (f.i(this.f9243a).f9168b.getInt("tbs_downloaddecouplecore", 0) == 1) {
b2 = TbsLogReport.b(this.f9243a);
eventType = TbsLogReport.EventType.TYPE_DOWNLOAD_DECOUPLE;
} else {
b2 = TbsLogReport.b(this.f9243a);
eventType = TbsLogReport.EventType.TYPE_DOWNLOAD;
}
b2.k(eventType, a2);
}
}
public final boolean w(boolean z2) {
d.s.b.c.c.g("TbsDownload", "[TbsApkDownloader.deleteFile] isApk=" + z2);
File file = z2 ? new File(this.f9247e, "x5.tbs") : new File(this.f9247e, "x5.tbs.temp");
if (file.exists()) {
return file.delete();
}
return true;
}
public final boolean x(boolean r13, boolean r14) {
throw new UnsupportedOperationException("Method not decompiled: d.s.b.b.w.x(boolean, boolean):boolean");
}
public void y() {
u();
w(false);
w(true);
}
public final void z() {
this.f9252j = 0;
this.f9253k = 0;
this.f9248f = -1L;
this.f9246d = null;
this.f9251i = false;
this.f9254l = false;
this.f9255m = false;
this.r = false;
}
}