QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 QBPatchTestAssist.java 源代码,内容仅作参考
package com.tencent.mtt.patch;
import android.content.Context;
import android.text.TextUtils;
import android.widget.Toast;
import com.tencent.common.threadpool.BrowserExecutorSupplier;
import com.tencent.common.utils.FileUtils;
import com.tencent.common.utils.FileUtilsF;
import com.tencent.common.utils.Md5Utils;
import com.tencent.common.utils.QBSoLoader;
import com.tencent.common.utils.UrlUtils;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.base.utils.MttFileUtils;
import com.tencent.mtt.browser.QBTbsFactory;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.hippy.dom.node.NodeProps;
import com.tencent.mtt.javaswitch.QBPatchSwitch;
import com.tencent.mtt.log.access.Logs;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.qbinfo.IQConfigure;
import com.tencent.mtt.view.toast.MttToaster;
import com.tencent.tinker.lib.tinker.TinkerApplicationHelper;
import com.tencent.tinker.loader.shareutil.ShareConstants;
import com.tencent.tinker.loader.shareutil.ShareTinkerInternals;
import dalvik.system.DexClassLoader;
import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
public class QBPatchTestAssist {
class AnonymousClass1 extends Thread {
final QBPatchTestAssist f69256a;
@Override
public void run() {
String str;
boolean z;
boolean z2;
try {
QBPatchStat.a("BONPH_NC_E_1");
File c2 = MttFileUtils.c();
if (this.f69256a.a(c2)) {
File a2 = FileUtils.a(c2, ".test_lzma");
if (this.f69256a.a(a2)) {
try {
FileUtils.c(a2);
} catch (IOException e) {
QBPatchStat.a("BONPH_NC_E_4");
Logs.a("QBPatch.Test", (Throwable) e);
}
Logs.c("QBPatch.Test", "lzma: unzip core so to " + a2.getAbsolutePath());
int a3 = QBTbsFactory.a().a(QBPatchContext.f69232a, a2.getAbsolutePath());
File[] listFiles = a2.listFiles();
if (listFiles != null) {
z = false;
z2 = false;
for (File file : listFiles) {
String a4 = Md5Utils.a(file);
File file2 = new File(FileUtils.f(QBPatchContext.f69232a), file.getName());
if (!z2 && !file2.exists()) {
z2 = false;
String a5 = Md5Utils.a(file2);
Logs.c("QBPatch.Test", "lzma: " + file.getName() + " md5: extracted: " + a4 + " coreshare: " + a5);
if (!z && !a4.equals(a5)) {
z = false;
StringBuilder sb = new StringBuilder();
sb.append("lzma: ");
sb.append(file.getName());
sb.append(" verify result: ");
sb.append(!a4.equals(a5) ? "match" : "not match");
Logs.c("QBPatch.Test", sb.toString());
}
z = true;
StringBuilder sb2 = new StringBuilder();
sb2.append("lzma: ");
sb2.append(file.getName());
sb2.append(" verify result: ");
sb2.append(!a4.equals(a5) ? "match" : "not match");
Logs.c("QBPatch.Test", sb2.toString());
}
z2 = true;
String a52 = Md5Utils.a(file2);
Logs.c("QBPatch.Test", "lzma: " + file.getName() + " md5: extracted: " + a4 + " coreshare: " + a52);
if (!z) {
z = false;
StringBuilder sb22 = new StringBuilder();
sb22.append("lzma: ");
sb22.append(file.getName());
sb22.append(" verify result: ");
sb22.append(!a4.equals(a52) ? "match" : "not match");
Logs.c("QBPatch.Test", sb22.toString());
}
z = true;
StringBuilder sb222 = new StringBuilder();
sb222.append("lzma: ");
sb222.append(file.getName());
sb222.append(" verify result: ");
sb222.append(!a4.equals(a52) ? "match" : "not match");
Logs.c("QBPatch.Test", sb222.toString());
}
} else {
z = false;
z2 = false;
}
Logs.c("QBPatch.Test", "lzma: unzip core so done");
this.f69256a.a(c2, a3, z, z2);
return;
}
str = "BONPH_NC_E_3";
} else {
str = "BONPH_NC_E_2";
}
QBPatchStat.a(str);
} catch (Throwable th) {
QBPatchStat.a("BONPH_NC_E_7");
Logs.a("QBPatch.Test", th);
}
}
}
public static void a() {
ArrayList arrayList = new ArrayList();
try {
File file = new File(QBPatchContext.f69232a.getApplicationInfo().nativeLibraryDir);
File file2 = new File(FileUtilsF.d().getCanonicalFile(), "patchtest_" + IQConfigure.g);
File file3 = new File(file2, ShareConstants.DEX_PATH);
File file4 = new File(file3, "patchtest_dex.jar");
File file5 = new File(file2, "odex");
for (File file6 : new File[]{file3, file5}) {
if (file6.exists() && file6.isDirectory()) {
FileUtilsF.c(file6);
}
file6.mkdirs();
}
File file7 = new File(file, "libpatchtest_dex.so");
if (file7.exists()) {
FileUtilsF.a(file7.getAbsolutePath(), file4.getAbsolutePath());
} else {
ZipFile zipFile = new ZipFile(QBPatchContext.f69232a.getPackageCodePath());
arrayList.add(new Closer(zipFile));
ZipEntry entry = zipFile.getEntry("lib/armeabi/libpatchtest_dex.so");
if (entry != null) {
InputStream inputStream = zipFile.getInputStream(entry);
arrayList.add(inputStream);
FileOutputStream fileOutputStream = new FileOutputStream(file4);
arrayList.add(fileOutputStream);
byte[] bArr = new byte[ShareConstants.MD5_FILE_BUF_LENGTH];
while (true) {
int read = inputStream.read(bArr);
if (read == -1) {
break;
} else {
fileOutputStream.write(bArr, 0, read);
}
}
}
}
Object invoke = QBTinkerManager.b().a("", "patchtest_dex.jar", new DexClassLoader(file4.getAbsolutePath(), file5.getAbsolutePath(), file.getAbsolutePath(), QBPatchContext.f69232a.getClassLoader())).loadClass("com.tencent.mtt.patch.dex.TestDex").getDeclaredMethod("getInt", new Class[0]).invoke(null, new Object[0]);
QBPatchContext.f69235d.d("QBPatch.Test", "TestDex invoke result = " + invoke, new Object[0]);
Toast.makeText(ContextHolder.getAppContext(), "TestDex.getInt = " + invoke + " (1=base;2=patch)", 1).show();
} catch (Throwable th) {
try {
QBPatchContext.f69235d.e("QBPatch.Test", th.getMessage(), th);
Iterator it = arrayList.iterator();
while (it.hasNext()) {
try {
((Closeable) it.next()).close();
} catch (Throwable unused) {
}
}
} finally {
Iterator it2 = arrayList.iterator();
while (it2.hasNext()) {
try {
((Closeable) it2.next()).close();
} catch (Throwable unused2) {
}
}
}
}
}
public void a(File file, int i, boolean z, boolean z2) {
String str;
if (z) {
str = "BONPH_NC_E_5";
} else if (z2) {
QBPatchStat.a("BONPH_NC_E_6");
str = "BONPH_NC_E_6_" + i;
} else {
str = "BONPH_NC_E_8";
}
QBPatchStat.a(str);
if (z) {
return;
}
long e = (FileUtils.e(file.getAbsolutePath()) / 1024) / 1024;
if (e <= 100) {
StringBuilder sb = new StringBuilder();
sb.append("BONPH_NC_");
sb.append(e <= 50 ? "E_9_1" : "E_9_2");
QBPatchStat.a(sb.toString());
QBPatchStat.a("BONPH_NC_E_9_3_" + ((e / 10) * 10));
}
}
public static void a(String str, boolean z) {
Logs.c("QBPatch.Test", "setDebugSwitch(" + str + ", " + z + ")");
if (!z) {
QBPatchContext.a().remove(str);
return;
}
long currentTimeMillis = (System.currentTimeMillis() + 28800000) / 86400000;
Logs.c("QBPatch.Test", "setDebugSwitch: today=" + currentTimeMillis);
QBPatchContext.a().setLong(str, currentTimeMillis);
}
public boolean a(File file) {
return file != null && file.exists() && file.isDirectory();
}
public static boolean a(String str) {
return (System.currentTimeMillis() + 28800000) / 86400000 == QBPatchContext.a().getLong(str, 0L);
}
public static void b() {
if (QBPatchSwitch.openAndDebug() && QBTinkerUtils.e() == 1 && QBTinkerUtils.f()) {
final String str = "PatchTestJni=" + QBSoLoader.tinkerSoLoadLibraryPath("patchtestjni");
QBPatchContext.f69235d.d("QBPatch.Test", str, new Object[0]);
if (a("patch_debug_show_toast")) {
final Context appContext = ContextHolder.getAppContext();
Runnable runnable = new Runnable() {
@Override
public void run() {
Toast.makeText(appContext, str, 1).show();
}
};
if (QBTinkerUtils.k()) {
runnable.run();
} else {
BrowserExecutorSupplier.forMainThreadTasks().execute(runnable);
}
}
}
}
public void b(String str) {
String sb;
String sb2;
String sb3;
String str2;
boolean a2 = QBTinkerUtils.a();
boolean z = a2 || a("patch_debug_show_toast");
Logs.c("QBPatch.Test", "processUrlCmd: " + str + " debug=" + a2);
String path = UrlUtils.getPath(str);
if (TextUtils.isEmpty(path)) {
return;
}
String[] split = path.split("[/\\\\]");
String lowerCase = split[0].toLowerCase();
Boolean bool = null;
if (split.length > 1) {
if (NodeProps.ON.equalsIgnoreCase(split[1]) || "enable".equalsIgnoreCase(split[1]) || "debug".equalsIgnoreCase(split[1])) {
bool = true;
} else if ("off".equalsIgnoreCase(split[1]) || "disable".equalsIgnoreCase(split[1]) || "real".equalsIgnoreCase(split[1])) {
bool = false;
}
}
if (!QBTinkerUtils.f() && ("patch".equals(lowerCase) || "wup".equals(lowerCase) || "start".equals(lowerCase))) {
if (a2) {
MttToaster.show("当前版本不支持热补丁", 0);
return;
}
return;
}
if ("patch".equals(lowerCase)) {
if (bool == null) {
String g = QBTinkerUtils.g();
if (TextUtils.isEmpty(g)) {
str2 = "当前版本支持热补丁";
} else {
str2 = "已成功加载补丁" + g.substring(0, 8);
}
String str3 = str2 + ", Tinker=1.9.14.17";
Logs.c("QBPatch.Test", str3);
if (!z) {
return;
}
MttToaster.show(str3, 0);
sb3 = "BONPH_NC_B_1_0";
} else {
if ((!TinkerApplicationHelper.b(QBPatchContext.f69233b) && QBTinkerUtils.h()) || bool.equals(Boolean.valueOf(QBTinkerUtils.h()))) {
return;
}
QBTinkerUtils.a(bool.booleanValue(), "debugurl");
((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doRestartApp();
ShareTinkerInternals.killAllOtherProcess(QBPatchContext.f69232a);
StringBuilder sb4 = new StringBuilder();
sb4.append("BONPH_NC_B_1_");
sb4.append(bool.booleanValue() ? "2" : "1");
sb3 = sb4.toString();
}
QBPatchStat.a(sb3);
return;
}
if ("wup".equals(lowerCase)) {
boolean a3 = a("patch_debug_req_env_switch");
if (bool == null) {
if (z) {
StringBuilder sb5 = new StringBuilder();
sb5.append("热补丁处于");
sb5.append(a3 ? "测试" : "正式");
sb5.append("环境");
MttToaster.show(sb5.toString(), 0);
}
sb2 = "BONPH_NC_B_2_0";
} else {
if (bool.equals(Boolean.valueOf(a3))) {
return;
}
a("patch_debug_req_env_switch", bool.booleanValue());
if (z) {
StringBuilder sb6 = new StringBuilder();
sb6.append("热补丁已切换到");
sb6.append(bool.booleanValue() ? "测试" : "正式");
sb6.append("环境");
MttToaster.show(sb6.toString(), 0);
}
QBPatchAccess.getInstance().a().a(5);
StringBuilder sb7 = new StringBuilder();
sb7.append("BONPH_NC_B_2_");
sb7.append(bool.booleanValue() ? "2" : "1");
sb2 = sb7.toString();
}
QBPatchStat.a(sb2);
return;
}
if ("start".equals(lowerCase)) {
QBPatchAccess.getInstance().a().a(5);
QBPatchStat.a("BONPH_NC_B_3");
return;
}
if (!"toast".equals(lowerCase)) {
if ("lzma".equals(lowerCase)) {
return;
}
"ziptemp".equals(lowerCase);
return;
}
boolean a4 = a("patch_debug_show_toast");
if (bool == null) {
MttToaster.show("toast=" + a4, 0);
sb = "BONPH_NC_B_4_0";
} else {
a("patch_debug_show_toast", bool.booleanValue());
MttToaster.show("toast=" + bool, 0);
StringBuilder sb8 = new StringBuilder();
sb8.append("BONPH_NC_B_4_");
sb8.append(bool.booleanValue() ? "2" : "1");
sb = sb8.toString();
}
QBPatchStat.a(sb);
}
}