TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c

以下内容为反编译后的 QCloudReporter.java 源代码,内容仅作参考


package com.tencent.magnifiersdk.reporter;

import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import com.tencent.magnifiersdk.MagnifierSDK;
import com.tencent.magnifiersdk.ResultObject;
import com.tencent.magnifiersdk.reporter.IReporter;
import com.tencent.magnifiersdk.tools.ILogUtil;
import com.tencent.mobileqq.widget.IndexView;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Iterator;
import java.util.Locale;
import java.util.UUID;
import org.json.JSONObject;
public class QCloudReporter implements IReporter {
    private Handler mHandler;
    private static final String TAG = ILogUtil.getTAG(QCloudReporter.class);
    private static final String FILE_URL = String.format(Locale.US, "http://sngapm.qq.com/entrance/%d/uploadFile/", Integer.valueOf(MagnifierSDK.productId));
    private static final String JSON_URL = String.format(Locale.US, "http://sngapm.qq.com/entrance/%d/uploadJson/", Integer.valueOf(MagnifierSDK.productId));

    public QCloudReporter() {
        if (this.mHandler == null) {
            HandlerThread ht = new HandlerThread("QCloudReporter");
            ht.start();
            this.mHandler = new Handler(ht.getLooper());
        }
    }

    @Override
    public boolean report(ResultObject ro, IReporter.ReportResultCallback cb) {
        JSONObject jsonObj = ro.params;
        JSONObject fileObjList = jsonObj.optJSONObject(ReporterMachine.PREFIX_KEY_OF_FILE);
        JSONObject tempObj = jsonObj.optJSONObject(ReporterMachine.PREFIX_KEY_OF_PUB_INFO);
        try {
            int plugin = jsonObj.has("newplugin") ? jsonObj.getInt("newplugin") : tempObj.getInt("plugin");
            Iterator<?> iter = tempObj.keys();
            while (iter.hasNext()) {
                String key = iter.next();
                String value = tempObj.getString(key);
                jsonObj.put(key, value);
            }
            jsonObj.put("p_id", MagnifierSDK.productId);
            jsonObj.put("version", MagnifierSDK.version);
            jsonObj.put("manu", Build.BRAND);
            jsonObj.put("device", Build.MODEL);
            jsonObj.put("rdmuuid", MagnifierSDK.uuid);
            jsonObj.put("api_ver", 1);
            jsonObj.put("plugin_ver", 1);
            jsonObj.put("client_identify", UUID.randomUUID());
            jsonObj.put("plugin", plugin);
            jsonObj.remove(ReporterMachine.PREFIX_KEY_OF_PUB_INFO);
            StringBuffer sb = new StringBuffer(1024);
            if (fileObjList != null && plugin != 102) {
                String filePath = fileObjList.getString("fileObj1");
                jsonObj.put(ReporterMachine.PREFIX_KEY_OF_FILE, filePath);
                Iterator<?> ciKeys = jsonObj.keys();
                String key2 = ciKeys.next();
                String value2 = jsonObj.getString(key2);
                sb.append(key2).append("=").append(URLEncoder.encode(value2, "UTF-8"));
                while (ciKeys.hasNext()) {
                    String key3 = ciKeys.next();
                    String value3 = jsonObj.getString(key3);
                    sb.append(IndexView.f95329b).append(key3).append("=").append(URLEncoder.encode(value3, "UTF-8"));
                }
                sb.append("&a=1");
                String spec = FILE_URL + "?" + sb.toString();
                MagnifierSDK.ILOGUTIL.i(TAG, "[qcloud_report] file url: ", spec);
                URL url = new URL(spec);
                QCloudFileUploadRunnable fileUpload = new QCloudFileUploadRunnable(url, filePath, jsonObj, cb, ro.dbId, this.mHandler);
                this.mHandler.post(fileUpload);
            } else {
                sb.append("p_id=").append(MagnifierSDK.productId).append("&plugin=").append(plugin);
                sb.append("&version=").append(URLEncoder.encode(MagnifierSDK.version, "UTF-8")).append("&a=1");
                String spec2 = JSON_URL + "?" + sb.toString();
                MagnifierSDK.ILOGUTIL.i(TAG, "[qcloud_report] json url: ", spec2, " jsonObj: ", jsonObj.toString());
                URL url2 = new URL(spec2);
                JsonUploadRunnable jsonUpload = new JsonUploadRunnable(url2, jsonObj, cb, ro.dbId, this.mHandler);
                this.mHandler.post(jsonUpload);
            }
            return true;
        } catch (Exception e) {
            MagnifierSDK.ILOGUTIL.e(TAG, e.toString());
            return false;
        }
    }
}