package androidx.core.graphics.drawable;

import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.graphics.PorterDuff;
import android.graphics.drawable.Icon;
import android.net.Uri;
import android.os.Build;
import android.os.Parcelable;
import android.util.Log;
import androidx.versionedparcelable.CustomVersionedParcelable;
import java.lang.reflect.InvocationTargetException;

/* JADX INFO: loaded from: classes.dex */
public class IconCompat extends CustomVersionedParcelable {
    public static final PorterDuff.Mode a = PorterDuff.Mode.SRC_IN;

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

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public String f266k;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int f257b = -1;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public byte[] f259d = null;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public Parcelable f260e = null;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public int f261f = 0;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public int f262g = 0;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public ColorStateList f263h = null;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public PorterDuff.Mode f264i = a;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public String f265j = null;

    public static class a {
        public static int a(Object obj) {
            return ((Icon) obj).getResId();
        }

        public static String b(Object obj) {
            return ((Icon) obj).getResPackage();
        }

        public static int c(Object obj) {
            return ((Icon) obj).getType();
        }

        public static Uri d(Object obj) {
            return ((Icon) obj).getUri();
        }
    }

    public String toString() {
        String str;
        int iIntValue;
        if (this.f257b == -1) {
            return String.valueOf(this.f258c);
        }
        StringBuilder sb = new StringBuilder("Icon(typ=");
        switch (this.f257b) {
            case 1:
                str = "BITMAP";
                break;
            case 2:
                str = "RESOURCE";
                break;
            case 3:
                str = "DATA";
                break;
            case 4:
                str = "URI";
                break;
            case 5:
                str = "BITMAP_MASKABLE";
                break;
            case 6:
                str = "URI_MASKABLE";
                break;
            default:
                str = "UNKNOWN";
                break;
        }
        sb.append(str);
        switch (this.f257b) {
            case 1:
            case 5:
                sb.append(" size=");
                sb.append(((Bitmap) this.f258c).getWidth());
                sb.append("x");
                sb.append(((Bitmap) this.f258c).getHeight());
                break;
            case 2:
                sb.append(" pkg=");
                sb.append(this.f266k);
                sb.append(" id=");
                Object[] objArr = new Object[1];
                int i2 = this.f257b;
                if (i2 == -1) {
                    int i3 = Build.VERSION.SDK_INT;
                    Object obj = this.f258c;
                    if (i3 >= 28) {
                        iIntValue = a.a(obj);
                    } else {
                        try {
                            iIntValue = ((Integer) obj.getClass().getMethod("getResId", new Class[0]).invoke(obj, new Object[0])).intValue();
                        } catch (IllegalAccessException e2) {
                            Log.e("IconCompat", "Unable to get icon resource", e2);
                            iIntValue = 0;
                        } catch (NoSuchMethodException e3) {
                            Log.e("IconCompat", "Unable to get icon resource", e3);
                            iIntValue = 0;
                        } catch (InvocationTargetException e4) {
                            Log.e("IconCompat", "Unable to get icon resource", e4);
                            iIntValue = 0;
                        }
                    }
                } else {
                    if (i2 != 2) {
                        throw new IllegalStateException("called getResId() on " + this);
                    }
                    iIntValue = this.f261f;
                }
                objArr[0] = Integer.valueOf(iIntValue);
                sb.append(String.format("0x%08x", objArr));
                break;
            case 3:
                sb.append(" len=");
                sb.append(this.f261f);
                if (this.f262g != 0) {
                    sb.append(" off=");
                    sb.append(this.f262g);
                }
                break;
            case 4:
            case 6:
                sb.append(" uri=");
                sb.append(this.f258c);
                break;
        }
        if (this.f263h != null) {
            sb.append(" tint=");
            sb.append(this.f263h);
        }
        if (this.f264i != a) {
            sb.append(" mode=");
            sb.append(this.f264i);
        }
        sb.append(")");
        return sb.toString();
    }
}
