package com.ss.android.ugc.aweme.utils;

import X.Lnj;
import X.P94;
import X.Spj;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.google.gson.Gson;
import com.google.gson.e;
import com.google.gson.v;
import com.ss.android.ugc.aweme.net.BaseResponseObjectTypeAdapterFactory;
import com.ss.android.ugc.aweme.net.CollectionTypeAdapterFactory;
import com.ss.android.ugc.aweme.net.ModelCheckerTypeAdapterFactory;
import com.ss.android.ugc.aweme.net.MusicTypeAdapterFactory;
import com.ss.android.ugc.aweme.net.UserTypeAdapterFactory;
import com.ss.android.ugc.aweme.sticker.model.BackgroundVideo;
import com.ss.android.ugc.aweme.typeadapter.BackgroundVideoDeserializer;
import java.lang.reflect.Type;

public class GsonHolder implements GsonProvider {
    public final Gson LIZ;
    public final Gson LIZIZ;

    static {
        Covode.recordClassIndex(122039);
    }

    public final Gson LIZIZ() {
        return this.LIZ;
    }

    public GsonHolder() {
        e LIZ2 = LIZ();
        Spj.LIZ.LIZ(LIZ2);
        Gson LIZIZ2 = LIZ2.LIZIZ();
        this.LIZ = LIZIZ2;
        this.LIZIZ = LIZIZ2;
    }

    public static e LIZ() {
        e LIZ2 = P94.LIZ();
        LIZ2.LIZ((v) new ModelCheckerTypeAdapterFactory());
        LIZ2.LIZ((v) new CollectionTypeAdapterFactory());
        LIZ2.LIZ((v) new MusicTypeAdapterFactory());
        LIZ2.LIZ((v) new UserTypeAdapterFactory());
        LIZ2.LIZ((Type) BackgroundVideo.class, (Object) new BackgroundVideoDeserializer());
        LIZ2.LIZ((v) new BaseResponseObjectTypeAdapterFactory());
        return LIZ2;
    }

    public static GsonProvider LIZJ() {
        MethodCollector.i(10911);
        GsonProvider gsonProvider = (GsonProvider) Lnj.LIZ(GsonProvider.class, false);
        if (gsonProvider != null) {
            MethodCollector.o(10911);
            return gsonProvider;
        }
        Object LIZIZ2 = Lnj.LIZIZ(GsonProvider.class, false);
        if (LIZIZ2 != null) {
            GsonProvider gsonProvider2 = (GsonProvider) LIZIZ2;
            MethodCollector.o(10911);
            return gsonProvider2;
        }
        if (Lnj.bP == null) {
            synchronized (GsonProvider.class) {
                try {
                    if (Lnj.bP == null) {
                        Lnj.bP = new GsonHolder();
                    }
                } catch (Throwable th) {
                    MethodCollector.o(10911);
                    throw th;
                }
            }
        }
        GsonHolder gsonHolder = (GsonHolder) Lnj.bP;
        MethodCollector.o(10911);
        return gsonHolder;
    }
}
