package com.apm.insight;

import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.json.JSONArray;

/* JADX INFO: loaded from: classes.dex */
public final class b implements ICrashCallback, IOOMCallback {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private IOOMCallback f5001a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private ICrashCallback f5002b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private String f5003c;

    public b(String str, ICrashCallback iCrashCallback) {
        this.f5003c = str;
        this.f5002b = iCrashCallback;
    }

    public final void a(@NonNull CrashType crashType, @Nullable Throwable th, @Nullable Thread thread, long j10, JSONArray jSONArray) {
        if (this.f5001a == null || jSONArray == null) {
            return;
        }
        for (int i10 = 0; i10 < jSONArray.length(); i10++) {
            if (TextUtils.equals(a.a(jSONArray.optJSONObject(i10), "header", "aid"), this.f5003c)) {
                this.f5001a.onCrash(crashType, th, thread, j10);
            }
        }
    }

    @Override // com.apm.insight.ICrashCallback
    public final void onCrash(@NonNull CrashType crashType, @Nullable String str, @Nullable Thread thread) {
    }

    public b(String str, IOOMCallback iOOMCallback) {
        this.f5003c = str;
        this.f5001a = iOOMCallback;
    }

    @Override // com.apm.insight.IOOMCallback
    public final void onCrash(@NonNull CrashType crashType, @Nullable Throwable th, @Nullable Thread thread, long j10) {
    }

    public final void a(@NonNull CrashType crashType, @Nullable String str, @Nullable Thread thread, JSONArray jSONArray) {
        if (this.f5002b == null || jSONArray == null) {
            return;
        }
        for (int i10 = 0; i10 < jSONArray.length(); i10++) {
            if (TextUtils.equals(a.a(jSONArray.optJSONObject(i10), "header", "aid"), this.f5003c)) {
                this.f5002b.onCrash(crashType, str, thread);
            }
        }
    }

    public final void a(@NonNull CrashType crashType, @Nullable String str, @Nullable String str2, String str3) {
        d dVarA;
        if (this.f5002b == null || (dVarA = d.a(this.f5003c)) == null || !dVarA.a(str3, str2)) {
            return;
        }
        this.f5002b.onCrash(crashType, str, null);
    }
}
