package p037.p041.p043.p044;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.Log;
import android.util.SparseArray;
import android.util.TypedValue;
import java.util.WeakHashMap;
import p037.p041.p042.LayoutInflaterFactory2C1494;
import p037.p041.p051.C1670;
import p037.p065.p068.C1850;

/* JADX INFO: renamed from: މ.ؠ.މ.֏.֏, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
@SuppressLint({"RestrictedAPI"})
public final class C1527 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static final ThreadLocal<TypedValue> f4849 = new ThreadLocal<>();

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public static final WeakHashMap<Context, SparseArray<C1528>> f4850 = new WeakHashMap<>(0);

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public static final Object f4851 = new Object();

    /* JADX INFO: renamed from: މ.ؠ.މ.֏.֏$֏, reason: contains not printable characters */
    public static class C1528 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final ColorStateList f4852;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public final Configuration f4853;

        public C1528(ColorStateList colorStateList, Configuration configuration) {
            this.f4852 = colorStateList;
            this.f4853 = configuration;
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static ColorStateList m3022(Context context, int i) {
        C1528 c1528;
        synchronized (f4851) {
            SparseArray<C1528> sparseArray = f4850.get(context);
            if (sparseArray != null && sparseArray.size() > 0 && (c1528 = sparseArray.get(i)) != null) {
                if (c1528.f4853.equals(context.getResources().getConfiguration())) {
                    return c1528.f4852;
                }
                sparseArray.remove(i);
            }
            return null;
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static void m3023(Context context, int i, ColorStateList colorStateList) {
        synchronized (f4851) {
            SparseArray<C1528> sparseArray = f4850.get(context);
            if (sparseArray == null) {
                sparseArray = new SparseArray<>();
                f4850.put(context, sparseArray);
            }
            sparseArray.append(i, new C1528(colorStateList, context.getResources().getConfiguration()));
        }
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public static ColorStateList m3024(Context context, int i) {
        if (Build.VERSION.SDK_INT >= 23) {
            return context.getColorStateList(i);
        }
        ColorStateList colorStateListM3022 = m3022(context, i);
        if (colorStateListM3022 != null) {
            return colorStateListM3022;
        }
        Resources resources = context.getResources();
        TypedValue typedValue = f4849.get();
        if (typedValue == null) {
            typedValue = new TypedValue();
            f4849.set(typedValue);
        }
        resources.getValue(i, typedValue, true);
        int i2 = typedValue.type;
        boolean z = i2 >= 28 && i2 <= 31;
        ColorStateList colorStateListM2892 = null;
        if (!z) {
            Resources resources2 = context.getResources();
            try {
                colorStateListM2892 = LayoutInflaterFactory2C1494.C1505.m2892(resources2, resources2.getXml(i), context.getTheme());
            } catch (Exception e) {
                Log.e("AppCompatResources", "Failed to inflate ColorStateList, leaving it to the framework", e);
            }
        }
        if (colorStateListM2892 == null) {
            return C1850.m3652(context, i);
        }
        m3023(context, i, colorStateListM2892);
        return colorStateListM2892;
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public static Drawable m3025(Context context, int i) {
        return C1670.m3261().m3273(context, i);
    }
}
