TikTok.apk(点击下载) / AnonymousClass16M.java


package X;

import android.text.TextUtils;
import com.bytedance.covode.number.Covode;
import java.util.LinkedList;
import org.json.JSONObject;

/* renamed from: X.16M  reason: invalid class name */
public final class AnonymousClass16M implements AbstractC04910Ie {
    public static String LIZ = "https://i.isnssdk.com/monitor/collect/c/exception";
    public static final Object LIZLLL = new Object();
    public static volatile AnonymousClass16M LJIIIIZZ;
    public volatile int LIZIZ;
    public volatile JSONObject LIZJ;
    public final LinkedList<AnonymousClass0MK> LJ = new LinkedList<>();
    public volatile long LJFF;
    public volatile boolean LJI;
    public volatile long LJII;
    public volatile AnonymousClass0MD LJIIIZ;

    static {
        Covode.recordClassIndex(19679);
    }

    public AnonymousClass16M() {
        C04900Id.LIZ.LIZ(this);
        this.LJIIIZ = new AnonymousClass0MD();
    }

    public static AnonymousClass16M LIZ() {
        if (LJIIIIZZ == null) {
            synchronized (LIZLLL) {
                try {
                    if (LJIIIIZZ == null) {
                        LJIIIIZZ = new AnonymousClass16M();
                    }
                } catch (Throwable th) {
                    throw th;
                }
            }
        }
        return LJIIIIZZ;
    }

    private void LIZJ() {
        this.LJFF = System.currentTimeMillis();
        C04900Id.LIZ.LIZIZ(new AnonymousClass0MF(this));
    }

    @Override // X.AbstractC04910Ie
    public final void LIZ(long j) {
        try {
            if (this.LJIIIZ != null) {
                this.LJIIIZ.LIZ();
            }
            long currentTimeMillis = System.currentTimeMillis();
            if ((currentTimeMillis - this.LJFF > 1200000 && this.LIZIZ > 0) || this.LIZIZ > 20) {
                LIZJ();
            }
            if (this.LJI && currentTimeMillis - this.LJII > 1800000) {
                this.LJI = false;
            }
        } catch (Throwable unused) {
        }
    }

    public final void LIZ(String str, String str2) {
        int statusCode;
        try {
            if (C04750Ho.LIZ.LJII) {
                AnonymousClass0MJ.LIZ(AnonymousClass0JF.LIZ(str, C04470Gm.LJIIIIZZ()), str2.getBytes(), AnonymousClass0MI.GZIP, "application/json; charset=utf-8");
            }
        } catch (Throwable th) {
            if ((th instanceof AnonymousClass0MH) && (statusCode = th.getStatusCode()) >= 500 && statusCode <= 600) {
                this.LJII = System.currentTimeMillis();
                this.LJI = true;
            }
        }
    }

    public final void LIZ(String str, String str2, String str3, boolean z) {
        try {
            if (!TextUtils.isEmpty(str)) {
                if (!TextUtils.isEmpty(str2)) {
                    boolean z2 = false;
                    if (z) {
                        JSONObject jSONObject = new JSONObject(str2);
                        jSONObject.put("log_type", "log_exception");
                        if (str3 != null) {
                            if (str3.length() > 10240) {
                                jSONObject.put("extraMessage", str3.substring(0, 10240));
                            } else {
                                jSONObject.put("extraMessage", str3);
                            }
                        }
                    }
                    if (!C04750Ho.LIZ.LJII) {
                        if (this.LJIIIZ != null) {
                            this.LJIIIZ.LIZ(str, str2);
                        }
                        return;
                    }
                    boolean LIZ2 = C04750Ho.LIZ.LIZ(str);
                    boolean LIZIZ2 = C04750Ho.LIZ.LIZIZ(str3);
                    if ((LIZ2 || LIZIZ2) && !this.LJI) {
                        synchronized (LIZLLL) {
                            try {
                                int size = this.LJ.size();
                                if (size >= 20) {
                                    z2 = true;
                                }
                                this.LJ.add(new AnonymousClass0MK(str, str2));
                                this.LIZIZ = size + 1;
                            } finally {
                            }
                        }
                        if (z2) {
                            LIZJ();
                        }
                    }
                }
            }
        } catch (Throwable unused) {
        }
    }

    public final boolean LIZIZ() {
        return C04750Ho.LIZ.LJII && !C04750Ho.LIZ.LIZ("exception_filter_network");
    }
}