得物.apk(点击下载) / b.java


package com.tencent.open.b;

import a.f;
import a1.a;
import android.content.Context;
import android.os.Build;
import android.text.TextUtils;
import com.tencent.open.log.SLog;
import com.tencent.open.utils.g;
import com.tencent.open.utils.k;
import com.tencent.open.utils.l;
import com.tencent.open.utils.m;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executor;

/* compiled from: ProGuard */
public class b {

    /* renamed from: a  reason: collision with root package name */
    private static b f29361a;
    private String b = "";

    /* renamed from: c  reason: collision with root package name */
    private String f29362c = "";
    private String d = "";
    private String e = "";
    private String f = "";

    /* renamed from: g  reason: collision with root package name */
    private String f29363g = "";

    /* renamed from: h  reason: collision with root package name */
    private String f29364h = "";
    private List<Serializable> i = a.h();
    private List<Serializable> j = a.h();
    private Executor k = l.b();
    private boolean l;

    private b() {
    }

    private void c() {
        while (!this.j.isEmpty()) {
            c cVar = (c) this.j.remove(0);
            cVar.f29366a.put("appid", this.b);
            cVar.f29366a.put("app_name", this.f29362c);
            cVar.f29366a.put("app_ver", this.e);
            cVar.f29366a.put("pkg_name", this.f);
            cVar.f29366a.put("qq_install", this.f29363g);
            cVar.f29366a.put("qq_ver", this.f29364h);
            cVar.f29366a.put("openid", this.d);
            HashMap<String, String> hashMap = cVar.f29366a;
            hashMap.put("time_appid_openid", cVar.f29366a.get("time") + "_" + this.b + "_" + this.d);
            StringBuilder sb2 = new StringBuilder();
            sb2.append("fixDirtyData--------------------------");
            sb2.append(cVar);
            SLog.i("AttaReporter", sb2.toString());
            this.i.add(cVar);
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void d() {
        SLog.i("AttaReporter", "attaReportAtSubThread");
        if (!this.l) {
            List<Serializable> b2 = g.b("report_atta");
            this.l = b2.isEmpty();
            this.i.addAll(b2);
            Iterator<Serializable> it2 = b2.iterator();
            while (it2.hasNext()) {
                SLog.i("AttaReporter", "attaReportAtSubThread from db = " + it2.next());
            }
        }
        ArrayList arrayList = new ArrayList();
        while (!this.i.isEmpty()) {
            c cVar = (c) this.i.remove(0);
            if (!b(cVar)) {
                arrayList.add(cVar);
            }
        }
        if (!arrayList.isEmpty()) {
            StringBuilder h12 = f.h("attaReportAtSubThread fail size=");
            h12.append(arrayList.size());
            SLog.i("AttaReporter", h12.toString());
            Iterator it3 = arrayList.iterator();
            while (it3.hasNext()) {
                StringBuilder h13 = f.h("attaReportAtSubThread fail cache to db, ");
                h13.append((c) ((Serializable) it3.next()));
                SLog.i("AttaReporter", h13.toString());
            }
            g.a("report_atta", arrayList);
            this.l = false;
        } else if (!this.l) {
            SLog.i("AttaReporter", "attaReportAtSubThread clear db");
            g.a("report_atta");
            this.l = true;
        }
    }

    public static synchronized b a() {
        b bVar;
        synchronized (b.class) {
            if (f29361a == null) {
                f29361a = new b();
            }
            bVar = f29361a;
        }
        return bVar;
    }

    private c b(String str, String str2, Object obj, Map<String, Object> map) {
        String str3;
        String str4;
        String str5;
        String str6;
        long currentTimeMillis = System.currentTimeMillis();
        HashMap j12 = a01.a.j("attaid", "09400051119", "token", "9389887874");
        j12.put("time_appid_openid", currentTimeMillis + "_" + this.b + "_" + this.d);
        j12.put("time", String.valueOf(currentTimeMillis));
        j12.put("openid", this.d);
        j12.put("appid", this.b);
        j12.put("app_name", this.f29362c);
        j12.put("app_ver", this.e);
        j12.put("pkg_name", this.f);
        j12.put("os", "AND");
        j12.put("os_ver", Build.VERSION.RELEASE);
        j12.put("sdk_ver", "3.5.13.lite");
        j12.put("model_name", com.tencent.open.utils.f.a().c(g.a()));
        j12.put("interface_name", str);
        j12.put("interface_data", str2);
        String str7 = "";
        if (obj == null) {
            str3 = str7;
        } else {
            str3 = obj.toString();
        }
        j12.put("interface_result", str3);
        j12.put("qq_install", this.f29363g);
        j12.put("qq_ver", this.f29364h);
        if (map != null && !map.isEmpty()) {
            Object obj2 = map.get("reserve1");
            if (obj2 == null) {
                str4 = str7;
            } else {
                str4 = obj2.toString();
            }
            j12.put("reserve1", str4);
            Object obj3 = map.get("reserve2");
            if (obj3 == null) {
                str5 = str7;
            } else {
                str5 = obj3.toString();
            }
            j12.put("reserve2", str5);
            Object obj4 = map.get("reserve3");
            if (obj4 == null) {
                str6 = str7;
            } else {
                str6 = obj4.toString();
            }
            j12.put("reserve3", str6);
            Object obj5 = map.get("reserve4");
            if (obj5 != null) {
                str7 = obj5.toString();
            }
            j12.put("reserve4", str7);
        }
        return new c(j12);
    }

    public void a(String str, Context context) {
        SLog.i("AttaReporter", "init");
        this.b = str;
        this.f29362c = k.a(context);
        this.e = m.d(context, g.b());
        this.f = g.b();
        this.f29363g = k.b(context) ? "1" : "0";
        this.f29364h = m.c(context, "com.tencent.mobileqq");
        c();
        g.a();
    }

    public void a(String str) {
        SLog.i("AttaReporter", "updateOpenId");
        if (str == null) {
            str = "";
        }
        this.d = str;
    }

    public void a(String str, String str2) {
        a(str, str2, null);
    }

    public void a(String str, String str2, Map<String, Object> map) {
        a(str, str2, "", map);
    }

    public void a(String str, Object obj) {
        a(str, "", obj, null);
    }

    public void a(String str, String str2, Object obj, Map<String, Object> map) {
        c b2 = b(str, str2, obj, map);
        if (TextUtils.isEmpty(this.b) || TextUtils.isEmpty(this.f29362c) || g.a() == null) {
            StringBuilder h12 = f.h("attaReport cancel appid=");
            h12.append(this.b);
            h12.append(", mAppName=");
            h12.append(this.f29362c);
            h12.append(", context=");
            h12.append(g.a());
            h12.append(", ");
            h12.append(b2);
            SLog.i("AttaReporter", h12.toString());
            this.j.add(b2);
            return;
        }
        a(b2);
    }

    private void a(final c cVar) {
        this.k.execute(new Runnable() {
            /* class com.tencent.open.b.b.AnonymousClass1 */

            public void run() {
                b.this.i.add(cVar);
                if (!m.b(g.a())) {
                    StringBuilder h12 = f.h("attaReport net disconnect, ");
                    h12.append(cVar);
                    SLog.i("AttaReporter", h12.toString());
                    return;
                }
                try {
                    b.this.d();
                } catch (Exception e) {
                    SLog.e("AttaReporter", "Exception", e);
                }
            }
        });
    }

    private boolean b(c cVar) {
        int i3 = 0;
        do {
            i3++;
            try {
                SLog.i("AttaReporter", "doAttaReportItem post " + cVar);
                if (com.tencent.open.a.f.a().b("https://h.trace.qq.com/kv", cVar.f29366a).d() == 200) {
                    return true;
                }
                return false;
            } catch (Exception e6) {
                SLog.i("AttaReporter", "Exception", e6);
                if (i3 >= 2) {
                    return false;
                }
            }
        } while (i3 >= 2);
        return false;
    }

    public static String b() {
        return a().b;
    }
}