QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 jsLogReporter.java 源代码,内容仅作参考
package com.tencent.mtt.browser.jsextension.module;
import android.text.TextUtils;
import android.webkit.JavascriptInterface;
import com.tencent.common.http.Apn;
import com.tencent.common.task.TaskManager;
import com.tencent.common.threadpool.BrowserExecutorSupplier;
import com.tencent.common.utils.FileUtils;
import com.tencent.mtt.base.task.Task;
import com.tencent.mtt.base.task.TaskObserver;
import com.tencent.mtt.browser.WebEngine;
import com.tencent.mtt.browser.file.facade.IFileManager;
import com.tencent.mtt.browser.jsextension.JsHelper;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.setting.PublicSettingManager;
import java.io.File;
import java.net.URL;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Iterator;
public class jsLogReporter extends jsModuleCheckPriv {
ArrayList<Task> f42427a;
byte f42428b;
byte[] f42429c;
TaskObserver f42430d;
private String f;
private JsHelper g;
public class ReportRunnable extends BrowserExecutorSupplier.BackgroundRunable {
private ReportRunnable() {
}
@Override
@JavascriptInterface
public void doRun() {
ByteBuffer h;
String[] C = WebEngine.e().C();
boolean z = true;
if (C != null) {
int a2 = jsLogReporter.this.a();
for (int i = 0; i < C.length; i++) {
File file = new File(C[i]);
if (file.exists() && file.isFile() && file.length() != 0 && (h = FileUtils.h(file)) != null) {
if (h.position() == 0) {
FileUtils.h().a(h);
} else {
byte[] bArr = new byte[h.position()];
h.position(0);
h.get(bArr);
FileUtils.h().a(h);
Task createHttpUploadTask = ((IFileManager) QBContext.getInstance().getService(IFileManager.class)).createHttpUploadTask("https://log.imtt.qq.com/reportlog", (byte) i, bArr, "q-proxy-log", jsLogReporter.this.a(a2, C.length, i), null, true);
createHttpUploadTask.setIsBackgroudTask(true);
createHttpUploadTask.addObserver(jsLogReporter.this.f42430d);
synchronized (jsLogReporter.this.f42429c) {
jsLogReporter.this.f42427a.add(createHttpUploadTask);
}
}
}
}
}
synchronized (jsLogReporter.this.f42429c) {
if (jsLogReporter.this.f42428b != 2) {
z = false;
}
jsLogReporter.this.f42428b = (byte) 3;
}
if (z) {
jsLogReporter.this.report();
}
}
}
public jsLogReporter(JsHelper jsHelper, String str) {
super(jsHelper);
this.f42427a = new ArrayList<>();
this.f42428b = (byte) 0;
this.f42429c = new byte[0];
this.f42430d = new TaskObserver() {
@Override
public void onTaskCompleted(Task task) {
}
@Override
public void onTaskCreated(Task task) {
}
@Override
public void onTaskExtEvent(Task task) {
}
@Override
public void onTaskFailed(Task task) {
}
@Override
public void onTaskProgress(Task task) {
}
@Override
public void onTaskStarted(Task task) {
}
};
this.f = str;
this.g = jsHelper;
}
private boolean b() {
String url = this.g.getUrl();
if (TextUtils.isEmpty(url)) {
return false;
}
try {
URL url2 = new URL(url);
String host = url2.getHost();
return ("bbs.mb.qq.com".equalsIgnoreCase(host) || "mb.cs0309.3g.qq.com".equalsIgnoreCase(host)) && url2.getQuery().toLowerCase().indexOf("fromwhere") >= 0 && Apn.isWifiMode();
} catch (Exception unused) {
return false;
}
}
int a() {
int j;
synchronized (this.f42429c) {
j = PublicSettingManager.a().j();
}
return j;
}
String a(int i, int i2, int i3) {
return String.valueOf((i << 24) | (i2 << 16) | (i3 << 8) | 3);
}
@JavascriptInterface
public void prepare() {
if (b()) {
synchronized (this.f42429c) {
if (this.f42428b != 0) {
return;
}
this.f42428b = (byte) 1;
BrowserExecutorSupplier.postForTimeoutTasks(new ReportRunnable());
}
}
}
@JavascriptInterface
public void report() {
?? r3;
if (b()) {
synchronized (this.f42429c) {
byte b2 = this.f42428b;
r3 = 0;
r3 = 0;
r3 = 0;
if (b2 == 0) {
this.f42428b = (byte) 2;
BrowserExecutorSupplier.postForTimeoutTasks(new ReportRunnable());
} else if (b2 == 1) {
this.f42428b = (byte) 2;
} else if (b2 == 3) {
ArrayList<Task> arrayList = this.f42427a;
this.f42427a = new ArrayList<>();
this.f42428b = (byte) 0;
r3 = arrayList;
}
}
if (r3 != 0) {
Iterator it = r3.iterator();
while (it.hasNext()) {
TaskManager.a().a((Task) it.next());
}
}
}
}
}