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

import X.1oX;
import X.C42579Eq;
import X.LnX;
import X.Lnj;
import X.M12;
import android.app.Activity;
import android.content.res.Configuration;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import java.util.Locale;
import kotlin.h.b.n;

public final class LanguageService implements LanguageProvider {
    static {
        Covode.recordClassIndex(122054);
    }

    public final boolean LIZ() {
        return C42579Eq.LIZ.LIZ();
    }

    public static LanguageProvider LIZIZ() {
        MethodCollector.i(12053);
        LanguageProvider languageProvider = (LanguageProvider) Lnj.LIZ(LanguageProvider.class, false);
        if (languageProvider != null) {
            MethodCollector.o(12053);
            return languageProvider;
        }
        Object LIZIZ = Lnj.LIZIZ(LanguageProvider.class, false);
        if (LIZIZ != null) {
            LanguageProvider languageProvider2 = (LanguageProvider) LIZIZ;
            MethodCollector.o(12053);
            return languageProvider2;
        }
        if (Lnj.bR == null) {
            synchronized (LanguageProvider.class) {
                try {
                    if (Lnj.bR == null) {
                        Lnj.bR = new LanguageService();
                    }
                } catch (Throwable th) {
                    MethodCollector.o(12053);
                    throw th;
                }
            }
        }
        LanguageService languageService = (LanguageService) Lnj.bR;
        MethodCollector.o(12053);
        return languageService;
    }

    public final void LIZ(Activity activity) {
        LnX.LIZ(activity);
    }

    public final void LIZ(1oX r3, Configuration configuration) {
        M12.LIZ(r3, configuration);
        Locale LIZ = LnX.LIZ((String) null, (String) null, r3);
        if (!n.LIZ((Object) configuration.locale, (Object) LIZ)) {
            configuration.setLocale(LIZ);
        }
    }
}
