package com.bytedance.apm6.traffic;

import X.AnonymousClass9OZ;
import X.C396893n;
import X.C44439Lu;
import X.C45099Oi;
import X.C45169Op;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import com.bytedance.covode.number.Covode;
import com.bytedance.helios.sdk.utils.ServiceLifecycle;
import org.json.JSONException;
import org.json.JSONObject;

public class TrafficTransportService extends Service {
    public final C45099Oi LIZ = new AnonymousClass9OZ() {
        static {
            Covode.recordClassIndex(23778);
        }

        public final void LIZ(String str) {
            C44439Lu.LIZ.LIZ(str);
        }

        public final void LIZIZ(String str) {
            C45169Op.LIZ.LIZ(str);
        }

        public final void LIZJ(String str) {
            JSONObject jSONObject;
            try {
                jSONObject = new JSONObject(str);
            } catch (JSONException unused) {
                jSONObject = null;
            }
            C45169Op.LIZ.LIZ(jSONObject);
        }

        public final void LIZ(String str, String str2) {
            JSONObject jSONObject;
            try {
                jSONObject = new JSONObject(str2);
            } catch (JSONException unused) {
                jSONObject = null;
            }
            C45169Op.LIZ.LIZ(str, jSONObject);
        }

        public final void LIZ(String str, boolean z) {
            C44439Lu.LIZ.LIZ(str, z);
        }

        public final void LIZ(long j, String str, String str2, String str3, String str4, String str5) {
            JSONObject jSONObject;
            JSONObject jSONObject2 = null;
            try {
                jSONObject = new JSONObject(str4);
                try {
                    jSONObject2 = new JSONObject(str5);
                } catch (JSONException unused) {
                }
            } catch (JSONException unused2) {
                jSONObject = null;
            }
            C45169Op.LIZ.LIZ(j, str, str2, str3, jSONObject, jSONObject2);
        }
    };

    static {
        Covode.recordClassIndex(23777);
    }

    public int onStartCommand(Intent intent, int i, int i2) {
        ServiceLifecycle.onStartCommand(this, intent, i, i2);
        return super.onStartCommand(intent, i, i2);
    }

    public IBinder onBind(Intent intent) {
        return this.LIZ.asBinder();
    }

    public static void LIZ(Context context, ServiceConnection serviceConnection) {
        LIZ(context, new Intent(context, TrafficTransportService.class), serviceConnection);
    }

    public static boolean LIZ(Context context, Intent intent, ServiceConnection serviceConnection) {
        if (context == null || !(context instanceof Context)) {
            return context.bindService(intent, serviceConnection, 1);
        }
        if (C396893n.LIZ(context, intent, serviceConnection, 1)) {
            return true;
        }
        return context.bindService(intent, serviceConnection, 1);
    }
}
