package p010d;

import android.app.Activity;
import android.app.Dialog;
import android.app.LocaleManager;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.LocaleList;
import android.util.Log;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import android.window.OnBackInvokedDispatcher;
import java.lang.ref.WeakReference;
import java.util.Iterator;
import p010d.C0532c0;
import p011d0.C0598a;
import p011d0.C0608i;
import p037m.C1446b;

/* renamed from: d.f */
/* loaded from: classes.dex */
public abstract class AbstractC0539f {

    /* renamed from: d */
    public static C0532c0.ExecutorC0533a f1948d = new C0532c0.ExecutorC0533a(new C0532c0.ExecutorC0534b());

    /* renamed from: e */
    public static int f1949e = -100;

    /* renamed from: f */
    public static C0608i f1950f = null;

    /* renamed from: g */
    public static C0608i f1951g = null;

    /* renamed from: h */
    public static Boolean f1952h = null;

    /* renamed from: i */
    public static boolean f1953i = false;

    /* renamed from: j */
    public static final C1446b<WeakReference<AbstractC0539f>> f1954j = new C1446b<>();

    /* renamed from: k */
    public static final Object f1955k = new Object();

    /* renamed from: l */
    public static final Object f1956l = new Object();

    /* renamed from: d.f$a */
    /* loaded from: classes.dex */
    public static class C0540a {
        /* renamed from: a */
        public static LocaleList m3514a(String str) {
            LocaleList forLanguageTags;
            forLanguageTags = LocaleList.forLanguageTags(str);
            return forLanguageTags;
        }
    }

    /* renamed from: d.f$b */
    /* loaded from: classes.dex */
    public static class C0541b {
        /* renamed from: a */
        public static LocaleList m3513a(Object obj) {
            return ((LocaleManager) obj).getApplicationLocales();
        }

        /* renamed from: b */
        public static void m3512b(Object obj, LocaleList localeList) {
            ((LocaleManager) obj).setApplicationLocales(localeList);
        }
    }

    /* renamed from: E */
    public static void m3528E(AbstractC0539f abstractC0539f) {
        synchronized (f1955k) {
            m3527F(abstractC0539f);
        }
    }

    /* renamed from: F */
    public static void m3527F(AbstractC0539f abstractC0539f) {
        synchronized (f1955k) {
            Iterator<WeakReference<AbstractC0539f>> it = f1954j.iterator();
            while (it.hasNext()) {
                AbstractC0539f abstractC0539f2 = it.next().get();
                if (abstractC0539f2 == abstractC0539f || abstractC0539f2 == null) {
                    it.remove();
                }
            }
        }
    }

    /* renamed from: N */
    public static void m3526N(final Context context) {
        if (m3516u(context)) {
            if (C0598a.m3289c()) {
                if (f1953i) {
                    return;
                }
                f1948d.execute(new Runnable() { // from class: d.d
                    @Override // java.lang.Runnable
                    public final void run() {
                        AbstractC0539f.m3515v(context);
                    }
                });
                return;
            }
            synchronized (f1956l) {
                C0608i c0608i = f1950f;
                if (c0608i == null) {
                    if (f1951g == null) {
                        f1951g = C0608i.m3273c(C0532c0.m3540b(context));
                    }
                    if (f1951g.m3270f()) {
                        return;
                    }
                    f1950f = f1951g;
                } else if (!c0608i.equals(f1951g)) {
                    C0608i c0608i2 = f1950f;
                    f1951g = c0608i2;
                    C0532c0.m3541a(context, c0608i2.m3268h());
                }
            }
        }
    }

    /* renamed from: d */
    public static void m3524d(AbstractC0539f abstractC0539f) {
        synchronized (f1955k) {
            m3527F(abstractC0539f);
            f1954j.add(new WeakReference<>(abstractC0539f));
        }
    }

    /* renamed from: h */
    public static AbstractC0539f m3522h(Activity activity, InterfaceC0531c interfaceC0531c) {
        return new LayoutInflater$Factory2C0544g(activity, interfaceC0531c);
    }

    /* renamed from: i */
    public static AbstractC0539f m3521i(Dialog dialog, InterfaceC0531c interfaceC0531c) {
        return new LayoutInflater$Factory2C0544g(dialog, interfaceC0531c);
    }

    /* renamed from: k */
    public static C0608i m3520k() {
        if (C0598a.m3289c()) {
            Object m3518o = m3518o();
            if (m3518o != null) {
                return C0608i.m3267i(C0541b.m3513a(m3518o));
            }
        } else {
            C0608i c0608i = f1950f;
            if (c0608i != null) {
                return c0608i;
            }
        }
        return C0608i.m3271e();
    }

    /* renamed from: m */
    public static int m3519m() {
        return f1949e;
    }

    /* renamed from: o */
    public static Object m3518o() {
        Context mo3438l;
        Iterator<WeakReference<AbstractC0539f>> it = f1954j.iterator();
        while (it.hasNext()) {
            AbstractC0539f abstractC0539f = it.next().get();
            if (abstractC0539f != null && (mo3438l = abstractC0539f.mo3438l()) != null) {
                return mo3438l.getSystemService("locale");
            }
        }
        return null;
    }

    /* renamed from: q */
    public static C0608i m3517q() {
        return f1950f;
    }

    /* renamed from: u */
    public static boolean m3516u(Context context) {
        if (f1952h == null) {
            try {
                Bundle bundle = ServiceC0525a0.m3558a(context).metaData;
                if (bundle != null) {
                    f1952h = Boolean.valueOf(bundle.getBoolean("autoStoreLocales"));
                }
            } catch (PackageManager.NameNotFoundException unused) {
                Log.d("AppCompatDelegate", "Checking for metadata for AppLocalesMetadataHolderService : Service not found");
                f1952h = Boolean.FALSE;
            }
        }
        return f1952h.booleanValue();
    }

    /* renamed from: v */
    public static /* synthetic */ void m3515v(Context context) {
        C0532c0.m3539c(context);
        f1953i = true;
    }

    /* renamed from: A */
    public abstract void mo3505A();

    /* renamed from: B */
    public abstract void mo3503B(Bundle bundle);

    /* renamed from: C */
    public abstract void mo3501C();

    /* renamed from: D */
    public abstract void mo3499D();

    /* renamed from: G */
    public abstract boolean mo3495G(int i);

    /* renamed from: H */
    public abstract void mo3493H(int i);

    /* renamed from: I */
    public abstract void mo3491I(View view);

    /* renamed from: J */
    public abstract void mo3489J(View view, ViewGroup.LayoutParams layoutParams);

    /* renamed from: K */
    public void mo3487K(OnBackInvokedDispatcher onBackInvokedDispatcher) {
    }

    /* renamed from: L */
    public void mo3485L(int i) {
    }

    /* renamed from: M */
    public abstract void mo3483M(CharSequence charSequence);

    /* renamed from: e */
    public abstract void mo3448e(View view, ViewGroup.LayoutParams layoutParams);

    @Deprecated
    /* renamed from: f */
    public void m3523f(Context context) {
    }

    /* renamed from: g */
    public Context mo3445g(Context context) {
        m3523f(context);
        return context;
    }

    /* renamed from: j */
    public abstract <T extends View> T mo3441j(int i);

    /* renamed from: l */
    public Context mo3438l() {
        return null;
    }

    /* renamed from: n */
    public int mo3435n() {
        return -100;
    }

    /* renamed from: p */
    public abstract MenuInflater mo3432p();

    /* renamed from: r */
    public abstract AbstractC0521a mo3429r();

    /* renamed from: s */
    public abstract void mo3427s();

    /* renamed from: t */
    public abstract void mo3425t();

    /* renamed from: w */
    public abstract void mo3421w(Configuration configuration);

    /* renamed from: x */
    public abstract void mo3419x(Bundle bundle);

    /* renamed from: y */
    public abstract void mo3417y();

    /* renamed from: z */
    public abstract void mo3415z(Bundle bundle);
}