京东到家.apk(点击下载) / d.java


package com.tencent.tmsbeacon.a.b;

import android.os.Build;
import android.text.TextUtils;
import com.jdpay.common.bury.contants.BuryContant;
import com.tencent.tmsbeacon.a.c.f;
import com.tencent.tmsbeacon.base.net.BResponse;
import com.tencent.tmsbeacon.base.net.HttpMethod;
import com.tencent.tmsbeacon.base.net.call.Callback;
import com.tencent.tmsbeacon.base.net.call.e;
import com.tencent.tmsbeacon.base.util.c;
import com.xiaomi.mipush.sdk.Constants;
import java.util.LinkedHashMap;
import java.util.Map;
import logo.i;

/* compiled from: TMS */
public class d {
    private static volatile d a;
    private static final Map<String, String> b = new LinkedHashMap();

    /* renamed from: c  reason: collision with root package name */
    private boolean f2392c = false;
    private boolean d = false;

    /* compiled from: TMS */
    public class a implements Callback<BResponse> {
        public a() {
        }

        /* renamed from: a */
        public void onResponse(BResponse bResponse) {
            c.a("AttaReport", "net ret: " + bResponse.toString(), new Object[0]);
        }

        @Override // com.tencent.tmsbeacon.base.net.call.Callback
        public void onFailure(com.tencent.tmsbeacon.base.net.d dVar) {
        }
    }

    /* compiled from: TMS */
    public class b implements Runnable {
        public final /* synthetic */ String b;

        /* renamed from: c  reason: collision with root package name */
        public final /* synthetic */ String f2393c;
        public final /* synthetic */ Throwable d;
        public final /* synthetic */ Callback e;

        public b(String str, String str2, Throwable th, Callback callback) {
            this.b = str;
            this.f2393c = str2;
            this.d = th;
            this.e = callback;
        }

        public void run() {
            synchronized (d.this) {
                LinkedHashMap linkedHashMap = new LinkedHashMap(d.b);
                linkedHashMap.put("error_code", this.b);
                linkedHashMap.put("error_msg", this.f2393c);
                linkedHashMap.put("error_stack_full", com.tencent.tmsbeacon.base.util.b.a(this.d));
                linkedHashMap.put("_dc", String.valueOf(Math.random()));
                com.tencent.tmsbeacon.base.net.c.c().a(e.b().b("https://h.trace.qq.com/kv").a("atta").a(linkedHashMap).a(HttpMethod.POST).a()).a(this.e);
                c.d("[atta] upload a new error, errorCode: %s, message: %s, stack: %s", this.b, this.f2393c, com.tencent.tmsbeacon.base.util.b.a(this.d));
            }
        }
    }

    private d() {
    }

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

    private synchronized void d() {
        if (!this.f2392c) {
            Map<String, String> map = b;
            map.put("attaid", "00400014144");
            map.put("token", "6478159937");
            map.put("error_code", "");
            map.put("platform", BuryContant.SYSTEM_ANDROID);
            map.put("uin", com.tencent.tmsbeacon.a.c.e.l().d());
            map.put(i.b.T, Build.BOARD + " " + f.e().h());
            map.put("os", com.tencent.tmsbeacon.a.c.e.l().s());
            map.put("error_msg", "");
            map.put("error_stack_full", "");
            map.put(Constants.EXTRA_KEY_APP_VERSION, com.tencent.tmsbeacon.a.c.b.a());
            map.put("sdk_version", com.tencent.tmsbeacon.a.c.c.d().i());
            map.put("product_id", com.tencent.tmsbeacon.a.c.c.d().f());
            map.put("_dc", "");
            this.f2392c = true;
        }
    }

    public boolean c() {
        if (this.d) {
            return true;
        }
        if (c.a()) {
            return false;
        }
        String d2 = com.tencent.tmsbeacon.a.c.e.l().d();
        if (!TextUtils.isEmpty(d2) && ((double) Math.abs(d2.hashCode() % 10000)) < 100.0d) {
            return true;
        }
        return false;
    }

    public void a(boolean z) {
        this.d = z;
    }

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

    public synchronized void a(String str, String str2, Throwable th) {
        a(str, str2, th, new a());
    }

    public synchronized void a(String str, String str2, Throwable th, Callback<BResponse> callback) {
        if (c()) {
            if (!this.f2392c) {
                d();
            }
            if (TextUtils.isEmpty(str)) {
                c.b("[atta] errorCode isn't valid value!", new Object[0]);
            } else {
                a.a().a(new b(str, str2, th, callback));
            }
        }
    }
}