百度手机卫士 v8.8.0版本的 MD5 值为:a85894a6923c8a39f0c3a3a686ad7443
以下内容为反编译后的 SavedTrafficManager.java 源代码,内容仅作参考
package com.quickbird.sdk.internal;
import android.content.Context;
import android.text.TextUtils;
import com.quickbird.sdk.QuickBird;
import com.quickbird.sdk.TrafficInfo;
import com.quickbird.sdk.utils.QBLogger;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
public class SavedTrafficManager {
private List<TrafficInfo> trafficList = new ArrayList();
public List<TrafficInfo> query(Context context, String str, String str2, String str3) {
List<TrafficInfo> list;
String str4;
String str5;
String userToken;
long currentTimeMillis = System.currentTimeMillis();
this.trafficList.clear();
try {
try {
userToken = QBConfigsMgr.getUserToken(context);
} catch (Exception e) {
e.printStackTrace();
list = null;
if (QuickBird.SDK_DEBUG) {
str4 = QuickBird.SDK_TAG;
str5 = "Query traffic used:" + (System.currentTimeMillis() - currentTimeMillis) + " ms";
}
}
if (TextUtils.isEmpty(userToken)) {
if (QuickBird.SDK_DEBUG) {
QBLogger.e(QuickBird.SDK_TAG, "Query error! Vpn unregist.");
}
list = null;
if (QuickBird.SDK_DEBUG) {
str4 = QuickBird.SDK_TAG;
str5 = "Query traffic used:" + (System.currentTimeMillis() - currentTimeMillis) + " ms";
QBLogger.d(str4, str5);
}
return list;
}
JSONObject jSONObject = new JSONObject();
jSONObject.put("token", userToken);
if (!TextUtils.isEmpty(str2)) {
jSONObject.put("stats_begin", str2);
}
if (!TextUtils.isEmpty(str3)) {
jSONObject.put("stats_end", str3);
}
if (!TextUtils.isEmpty(str)) {
jSONObject.put("packet_name", str);
}
if (QuickBird.SDK_DEBUG) {
QBLogger.d(QuickBird.SDK_TAG, "Posting:https://sjws-tzapi.baidu.com/report/bsd/");
QBLogger.d(QuickBird.SDK_TAG, jSONObject.toString());
}
String post = HttpsClient.post(context, SdkConstant.TRAFFIC_REPORT_URL, jSONObject);
if (QuickBird.SDK_DEBUG) {
QBLogger.d(QuickBird.SDK_TAG, "Respond:");
QBLogger.d(QuickBird.SDK_TAG, post);
}
JSONObject jSONObject2 = new JSONObject(post);
JSONArray names = jSONObject2.names();
if (names == null || names.length() == 0) {
list = this.trafficList;
if (QuickBird.SDK_DEBUG) {
str4 = QuickBird.SDK_TAG;
str5 = "Query traffic used:" + (System.currentTimeMillis() - currentTimeMillis) + " ms";
QBLogger.d(str4, str5);
}
return list;
}
long j = 0;
for (int i = 0; i < names.length(); i++) {
String string = names.getString(i);
JSONArray jSONArray = jSONObject2.getJSONArray(string);
for (int i2 = 0; i2 < jSONArray.length(); i2++) {
JSONObject jSONObject3 = jSONArray.getJSONObject(i2);
TrafficInfo trafficInfo = new TrafficInfo();
trafficInfo.setDate(string);
trafficInfo.setPackageName(jSONObject3.getString("packet_name"));
trafficInfo.setBytesAfter(jSONObject3.getLong("bytes_after"));
trafficInfo.setBytesBefore(jSONObject3.getLong("bytes_before"));
j += trafficInfo.getBytesBefore() - trafficInfo.getBytesAfter();
this.trafficList.add(trafficInfo);
}
}
if (QuickBird.SDK_DEBUG) {
QBLogger.i(QuickBird.SDK_TAG, "Saved traffic:" + j);
}
list = this.trafficList;
if (QuickBird.SDK_DEBUG) {
str4 = QuickBird.SDK_TAG;
str5 = "Query traffic used:" + (System.currentTimeMillis() - currentTimeMillis) + " ms";
QBLogger.d(str4, str5);
}
return list;
} catch (Throwable th) {
if (QuickBird.SDK_DEBUG) {
QBLogger.d(QuickBird.SDK_TAG, "Query traffic used:" + (System.currentTimeMillis() - currentTimeMillis) + " ms");
}
throw th;
}
}
}