Spermatid v6.1.8版本的 MD5 值为:a375ce51a42d528ba6e2583c10478296

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


package com.hailiang.advlib.common;

import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.text.TextUtils;
import android.util.Log;
import com.baidu.mobads.sdk.internal.bk;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;

public class d {

    public static final String f15621a = "https://tracelog-debug.qquanquan.com";

    public static final String f15622b = "https://logrcv.qquanquan.com/trace";

    public static String f15624d = "";

    public static long f15626f = 0;

    public static int f15627g = -1;

    public static long f15628h = 0;

    public static long f15629i = 0;

    public static int f15630j = -1;

    public static Handler f15632l;

    public static StringBuilder f15625e = new StringBuilder();

    public static String f15623c = "";

    public static final HandlerThread f15631k = new HandlerThread("cpc/sdk-remote-" + f15623c);

    public static class a implements Runnable {

        public final String f15633a;

        public a(String str) {
            this.f15633a = str;
        }

        @Override
        public void run() {
            try {
                d.a(this.f15633a);
            } catch (Throwable th) {
                th.printStackTrace();
            }
        }
    }

    public static Handler a() {
        if (f15632l == null) {
            synchronized (d.class) {
                if (f15632l == null) {
                    HandlerThread handlerThread = f15631k;
                    handlerThread.start();
                    f15632l = new Handler(handlerThread.getLooper());
                }
            }
        }
        return f15632l;
    }

    public static void b(Context context, int i10) {
        f15627g = i10;
        long currentTimeMillis = System.currentTimeMillis();
        f15629i = currentTimeMillis;
        long j10 = f15628h;
        long j11 = j10 > 0 ? currentTimeMillis - j10 : -1L;
        if (context == null || !b()) {
            return;
        }
        HashMap hashMap = new HashMap();
        hashMap.put("op1", "REPORT_TYPE");
        hashMap.put("opt_gap", j11 + "");
        hashMap.put("opt_loadId", f15628h + "");
        hashMap.put("opt_isNormalStart", f15627g + "");
        b(context, "LoadSdk", hashMap);
    }

    public static void c(Context context, String str, Map<String, String> map) {
        a(context, f15622b, str, map);
    }

    public static void a(Runnable runnable) {
        Handler a10 = a();
        if (a10 != null) {
            a10.post(runnable);
        }
    }

    public static void a(Runnable runnable, long j10) {
        Handler a10 = a();
        if (a10 != null) {
            a10.postDelayed(runnable, j10);
        }
    }

    public static void b(Context context, String str, Map<String, String> map) {
        a(context, f15621a, str, map);
    }

    public static void a(Context context, String str, String str2, String str3, String str4) {
        if (context != null) {
            HashMap hashMap = new HashMap();
            hashMap.put("op1", "CHECK_UPDATE");
            hashMap.put("opt_reqbody", str);
            hashMap.put("opt_respbody", str2);
            hashMap.put("opt_action", str3);
            hashMap.put("opt_md5", str4 + "");
            b(context, "LoadSdk", hashMap);
        }
    }

    public static boolean b() {
        if (f15630j == -1) {
            f15630j = new Random().nextInt(10);
        }
        return f15630j == 1;
    }

    public static void a(Context context, String str, String str2, long j10) {
        try {
            if (b()) {
                HashMap hashMap = new HashMap();
                hashMap.put("op1", str);
                hashMap.put("opt_download", bk.f4476g);
                hashMap.put("opt_url", str2 + "");
                if (j10 > 0) {
                    hashMap.put("opt_block_time", j10 + "");
                }
                b(context, "Download", hashMap);
            }
        } catch (Throwable unused) {
        }
    }

    public static void a(Context context) {
        if (context == null || !b()) {
            return;
        }
        f15628h = System.currentTimeMillis();
        HashMap hashMap = new HashMap();
        hashMap.put("op1", "START");
        hashMap.put("opt_loadId", f15628h + "");
        hashMap.put("opt_isNormalStart", f15627g + "");
        b(context, "LoadSdk", hashMap);
    }

    public static void a(Context context, String str) {
        if (context == null || !b()) {
            return;
        }
        HashMap hashMap = new HashMap();
        hashMap.put("op1", "LOAD_ERROR");
        hashMap.put("opt_error", str);
        try {
            hashMap.put("opt_process", e.c(context));
        } catch (Throwable unused) {
        }
        b(context, "LoadSdk", hashMap);
    }

    public static void a(Context context, boolean z10, boolean z11, boolean z12, long j10, long j11, Map map) {
        if (context == null || !b()) {
            return;
        }
        HashMap hashMap = new HashMap();
        hashMap.put("op1", "SUCCESS");
        hashMap.put("opt_isRemote", (z10 ? 1 : 0) + "");
        hashMap.put("opt_unzip", (z11 ? 1 : 0) + "");
        hashMap.put("opt_checkonline", (z12 ? 1 : 0) + "");
        hashMap.put("opt_checkTime", j11 + "");
        hashMap.put("opt_loadId", f15628h + "");
        hashMap.put("opt_loadTime", (System.currentTimeMillis() - j10) + "");
        hashMap.put("opt_gap", (f15629i > 0 ? System.currentTimeMillis() - f15629i : -1L) + "");
        hashMap.put("opt_isNormalStart", f15627g + "");
        if (map != null && map.size() > 0) {
            hashMap.putAll(map);
        }
        b(context, "LoadSdk", hashMap);
    }

    public static void a(Context context, int i10) {
        if (context == null || !b()) {
            return;
        }
        HashMap hashMap = new HashMap();
        hashMap.put("op1", "Loading");
        hashMap.put("opt_loadId", f15628h + "");
        hashMap.put("opt_step", i10 + "");
        f15625e.append(i10 + "-");
        hashMap.put("opt_path", f15625e.toString());
        long currentTimeMillis = f15626f != 0 ? System.currentTimeMillis() - f15626f : 0L;
        f15626f = System.currentTimeMillis();
        hashMap.put("opt_loadTime", currentTimeMillis + "");
        b(context, "LoadSdk", hashMap);
        Log.i("reportLoadsdkLoading", "step = " + i10 + " , time = " + currentTimeMillis);
    }

    public static void a(Context context, boolean z10, boolean z11, boolean z12, String str, long j10, Map map) {
        if (context != null) {
            HashMap hashMap = new HashMap();
            hashMap.put("op1", "FAIL");
            hashMap.put("opt_isRemote", (z10 ? 1 : 0) + "");
            hashMap.put("opt_unzip", (z11 ? 1 : 0) + "");
            hashMap.put("opt_checkonline", (z12 ? 1 : 0) + "");
            hashMap.put("opt_checkTime", j10 + "");
            hashMap.put("opt_cause", str);
            hashMap.put("opt_loadId", f15628h + "");
            hashMap.put("opt_gap", (f15629i > 0 ? System.currentTimeMillis() - f15629i : -1L) + "");
            hashMap.put("opt_isNormalStart", f15627g + "");
            hashMap.put("opt_lyr", "android_cpc_sdk_custom");
            if (map != null && map.size() > 0) {
                hashMap.putAll(map);
            }
            b(context, "LoadSdk", hashMap);
        }
    }

    public static void a(Context context, String str, String str2, Map<String, String> map) {
        a aVar = new a(a(str, (Map<String, String>) a(context, str2, map)));
        Handler a10 = a();
        if (a10 != null) {
            a10.post(aVar);
        }
    }

    public static String a(String str, Map<String, String> map) {
        return str + e.a(map);
    }

    public static Map a(Context context, String str, Map<String, String> map) {
        HashMap hashMap = new HashMap();
        hashMap.put("os", "Android");
        hashMap.put(CampaignEx.JSON_KEY_TIMESTAMP, String.valueOf(System.currentTimeMillis()));
        hashMap.put("opt_bootstrap_v", f15623c);
        hashMap.put("opt_lib_v", f15624d);
        hashMap.put("t", str + "");
        if (context != null) {
            hashMap.put("opt_app_pkgid", context.getPackageName());
            hashMap.put("opt_app_vn", e.b(context));
            hashMap.put("opt_app_vc", e.a(context) + "");
        }
        hashMap.put("opt_os_version", Build.VERSION.RELEASE + "");
        if (map != null) {
            try {
                Iterator<Map.Entry<String, String>> it = map.entrySet().iterator();
                while (it.hasNext()) {
                    String key = it.next().getKey();
                    hashMap.put(key, map.get(key));
                }
            } catch (Throwable unused) {
            }
        }
        try {
            String str2 = Build.BRAND;
            if (str2 != null) {
                hashMap.put("opt_brand", str2);
            }
            String str3 = Build.MODEL;
            if (str3 != null) {
                hashMap.put("opt_model", str3);
            }
        } catch (Exception e10) {
            e10.printStackTrace();
        }
        return hashMap;
    }

    public static void a(String str) throws Throwable {
        if (str == null || TextUtils.isEmpty(str)) {
            return;
        }
        if (str.startsWith("http://") || str.startsWith("https://")) {
            URLConnection openConnection = new URL(str).openConnection();
            try {
                openConnection.connect();
                int responseCode = ((HttpURLConnection) openConnection).getResponseCode();
                if (responseCode != 200) {
                    Log.e("NetUtils", "ERROR " + String.valueOf(responseCode) + " on url \"" + str + "\"");
                }
                try {
                    ((HttpURLConnection) openConnection).disconnect();
                } catch (Exception e10) {
                    e10.printStackTrace();
                }
            } catch (Throwable th) {
                try {
                    ((HttpURLConnection) openConnection).disconnect();
                } catch (Exception e11) {
                    e11.printStackTrace();
                }
                throw th;
            }
        }
    }
}