package p028j;

import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.DrawableContainer;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.ScaleDrawable;
import android.os.Build;
import p001a0.InterfaceC0011e0;
import p016f.C0683f;

/* renamed from: j.i2 */
/* loaded from: classes.dex */
public class C1115i2 {

    /* renamed from: a */
    public static final int[] f2716a = {16842912};

    /* renamed from: b */
    public static final int[] f2717b = new int[0];

    /* renamed from: c */
    public static final Rect f2718c = new Rect();

    /* renamed from: a */
    public static boolean m2118a(Drawable drawable) {
        Drawable drawable2;
        int i = Build.VERSION.SDK_INT;
        if (i >= 17) {
            return true;
        }
        if (i >= 17 || !(drawable instanceof LayerDrawable)) {
            if (!(drawable instanceof DrawableContainer)) {
                if (drawable instanceof InterfaceC0011e0) {
                    drawable2 = ((InterfaceC0011e0) drawable).mo5066a();
                } else if (drawable instanceof C0683f) {
                    drawable2 = ((C0683f) drawable).m3119a();
                } else if (drawable instanceof ScaleDrawable) {
                    drawable2 = ((ScaleDrawable) drawable).getDrawable();
                }
                return m2118a(drawable2);
            }
            Drawable.ConstantState constantState = drawable.getConstantState();
            if (constantState instanceof DrawableContainer.DrawableContainerState) {
                for (Drawable drawable3 : ((DrawableContainer.DrawableContainerState) constantState).getChildren()) {
                    if (!m2118a(drawable3)) {
                        return false;
                    }
                }
            }
            return true;
        }
        return false;
    }

    /* renamed from: b */
    public static void m2117b(Drawable drawable) {
        String name = drawable.getClass().getName();
        int i = Build.VERSION.SDK_INT;
        if (!(i == 21 && "android.graphics.drawable.VectorDrawable".equals(name)) && (i < 29 || i >= 31 || !"android.graphics.drawable.ColorStateListDrawable".equals(name))) {
            return;
        }
        m2116c(drawable);
    }

    /* renamed from: c */
    public static void m2116c(Drawable drawable) {
        int[] state = drawable.getState();
        if (state == null || state.length == 0) {
            drawable.setState(f2716a);
        } else {
            drawable.setState(f2717b);
        }
        drawable.setState(state);
    }

    /* renamed from: d */
    public static PorterDuff.Mode m2115d(int i, PorterDuff.Mode mode) {
        if (i != 3) {
            if (i != 5) {
                if (i != 9) {
                    switch (i) {
                        case 14:
                            return PorterDuff.Mode.MULTIPLY;
                        case 15:
                            return PorterDuff.Mode.SCREEN;
                        case 16:
                            return PorterDuff.Mode.ADD;
                        default:
                            return mode;
                    }
                }
                return PorterDuff.Mode.SRC_ATOP;
            }
            return PorterDuff.Mode.SRC_IN;
        }
        return PorterDuff.Mode.SRC_OVER;
    }
}