package j;

import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.AssetManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.view.LayoutInflater;

/* JADX INFO: loaded from: classes.dex */
public final class e extends ContextWrapper {

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static Configuration f28436f;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public int f28437a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public Resources.Theme f28438b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public LayoutInflater f28439c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public Configuration f28440d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public Resources f28441e;

    public e(Context context, int i10) {
        super(context);
        this.f28437a = i10;
    }

    public final void a(Configuration configuration) {
        if (this.f28441e != null) {
            throw new IllegalStateException("getResources() or getAssets() has already been called");
        }
        if (this.f28440d != null) {
            throw new IllegalStateException("Override configuration has already been set");
        }
        this.f28440d = new Configuration(configuration);
    }

    @Override // android.content.ContextWrapper
    public final void attachBaseContext(Context context) {
        super.attachBaseContext(context);
    }

    public final void b() {
        if (this.f28438b == null) {
            this.f28438b = getResources().newTheme();
            Resources.Theme theme = getBaseContext().getTheme();
            if (theme != null) {
                this.f28438b.setTo(theme);
            }
        }
        this.f28438b.applyStyle(this.f28437a, true);
    }

    @Override // android.content.ContextWrapper, android.content.Context
    public final AssetManager getAssets() {
        return getResources().getAssets();
    }

    /* JADX WARN: Removed duplicated region for block: B:15:0x0032  */
    @Override // android.content.ContextWrapper, android.content.Context
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Resources getResources() {
        if (this.f28441e == null) {
            Configuration configuration = this.f28440d;
            if (configuration == null) {
                this.f28441e = super.getResources();
            } else {
                if (Build.VERSION.SDK_INT >= 26) {
                    if (f28436f == null) {
                        Configuration configuration2 = new Configuration();
                        configuration2.fontScale = 0.0f;
                        f28436f = configuration2;
                    }
                    if (configuration.equals(f28436f)) {
                    }
                }
                this.f28441e = createConfigurationContext(this.f28440d).getResources();
            }
        }
        return this.f28441e;
    }

    @Override // android.content.ContextWrapper, android.content.Context
    public final Object getSystemService(String str) {
        if (!"layout_inflater".equals(str)) {
            return getBaseContext().getSystemService(str);
        }
        if (this.f28439c == null) {
            this.f28439c = LayoutInflater.from(getBaseContext()).cloneInContext(this);
        }
        return this.f28439c;
    }

    @Override // android.content.ContextWrapper, android.content.Context
    public final Resources.Theme getTheme() {
        Resources.Theme theme = this.f28438b;
        if (theme != null) {
            return theme;
        }
        if (this.f28437a == 0) {
            this.f28437a = d.i.Theme_AppCompat_Light;
        }
        b();
        return this.f28438b;
    }

    @Override // android.content.ContextWrapper, android.content.Context
    public final void setTheme(int i10) {
        if (this.f28437a != i10) {
            this.f28437a = i10;
            b();
        }
    }

    public e(Context context, Resources.Theme theme) {
        super(context);
        this.f28438b = theme;
    }
}
