package ai.advance.event;

import android.content.Context;
import com.facebook.GraphRequest;
import java.util.Locale;
import org.json.JSONObject;
import K.K.ʬ.C2355;
import K.K.ʬ.C2360;
import K.K.ʬ.C2361;

public class GuardianEvents extends C2361 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public String f42;

    /* renamed from: ඓ  reason: contains not printable characters */
    public String f43;

    /* renamed from: ῲ  reason: contains not printable characters */
    public Context f44;

    /* renamed from: K  reason: contains not printable characters */
    public JSONObject f45 = new JSONObject();

    /* renamed from: 㴹  reason: contains not printable characters */
    public long f46;

    /* renamed from: 㸾  reason: contains not printable characters */
    public String f47;

    public enum BizType {
        FACE_DETECTION,
        LIVENESS_DETECTION,
        IQA
    }

    public GuardianEvents(Context context, String str, String str2, String str3) {
        this.f42 = str;
        this.f47 = str2;
        this.f43 = str3;
        this.f44 = context;
        m56();
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    private void m56() {
        if (m58()) {
            synchronized (this) {
                if (this.f44 != null) {
                    String packageName = this.f44.getPackageName();
                    if (m58()) {
                        try {
                            this.f45.put("applicationId", packageName);
                        } catch (Exception unused) {
                        }
                    }
                }
                String locale = Locale.getDefault().toString();
                if (m58()) {
                    try {
                        this.f45.put("locale", locale);
                    } catch (Exception unused2) {
                    }
                }
                if (this.f42 != null) {
                    String str = this.f42;
                    if (m58()) {
                        try {
                            this.f45.put("bizType", str);
                        } catch (Exception unused3) {
                        }
                    }
                }
                String str2 = this.f47;
                if (m58()) {
                    try {
                        this.f45.put("sdkVersion", str2);
                    } catch (Exception unused4) {
                    }
                }
                Long valueOf = Long.valueOf(System.currentTimeMillis());
                if (m58()) {
                    try {
                        this.f45.put("eventTimestamp", valueOf);
                    } catch (Exception unused5) {
                    }
                }
                String str3 = this.f43;
                if (m58()) {
                    try {
                        this.f45.put("eventType", str3);
                    } catch (Exception unused6) {
                    }
                }
            }
        }
    }

    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Missing exception handler attribute for start block: B:14:0x002d */
    /* JADX WARNING: Removed duplicated region for block: B:19:0x0040  */
    /* JADX WARNING: Removed duplicated region for block: B:23:0x0057  */
    /* renamed from: K  reason: contains not printable characters */
    public JSONObject m57(JSONObject jSONObject) {
        if (m58()) {
            JSONObject jSONObject2 = new JSONObject();
            try {
                Context context = this.f44;
                JSONObject r3 = C2355.m6175();
                try {
                    r3.put("deviceId", C2355.m6174(context));
                    r3.put("networkStatus", C2360.m6193(context));
                } catch (Exception unused) {
                }
                jSONObject2.put("mobileInfo", r3);
            } catch (Exception unused2) {
            }
            jSONObject2.put("detail", jSONObject);
            try {
                this.f45.put(GraphRequest.DEBUG_SEVERITY_INFO, jSONObject2);
            } catch (Exception unused3) {
            }
            if (this.f46 <= 0) {
                Long valueOf = Long.valueOf(System.currentTimeMillis() - this.f46);
                if (m58()) {
                    try {
                        this.f45.put("eventCostInMilliSeconds", valueOf);
                    } catch (Exception unused4) {
                    }
                }
            } else if (m58()) {
                this.f45.put("eventCostInMilliSeconds", (Object) 0);
            }
        }
        return this.f45;
    }

    /* renamed from: K  reason: contains not printable characters */
    public final boolean m58() {
        return this.f45 != null;
    }
}
