package defpackage;

import android.graphics.Point;
import android.graphics.Rect;
import android.os.Build;
import android.view.Display;
import android.view.View;
import android.view.WindowInsets;
import j$.util.Objects;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/* renamed from: ˏˑᵦ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public abstract class AbstractC1850 extends C2387 {

    /* renamed from: ˌʾˀ, reason: contains not printable characters */
    public static Field f7478;

    /* renamed from: ᵡʠ, reason: contains not printable characters */
    public static Field f7479;

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public static Method f7480;

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public static boolean f7481;

    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public static Class f7482;

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public C4384 f7483;

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public Rect[][] f7484;

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public C4384 f7485;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public C4250 f7486;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final WindowInsets f7487;

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public int f7488;

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public int f7489;

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public Rect[][] f7490;

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public int f7491;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public C4384[] f7492;

    public AbstractC1850(C4250 c4250, WindowInsets windowInsets) {
        super(c4250);
        this.f7483 = null;
        this.f7490 = new Rect[10][];
        this.f7484 = new Rect[10][];
        this.f7487 = windowInsets;
    }

    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    private Rect[] m5220(C4384 c4384) {
        ArrayList arrayList = new ArrayList();
        int i = c4384.f16425;
        int i2 = c4384.f16427;
        int i3 = c4384.f16424;
        int i4 = c4384.f16426;
        if (i != 0) {
            arrayList.add(new Rect(0, 0, c4384.f16425, this.f7488));
        }
        if (i4 != 0) {
            arrayList.add(new Rect(0, 0, this.f7489, i4));
        }
        if (i3 != 0) {
            int i5 = this.f7489;
            arrayList.add(new Rect(i5 - i3, 0, i5, this.f7488));
        }
        if (i2 != 0) {
            int i6 = this.f7488;
            arrayList.add(new Rect(0, i6 - i2, this.f7489, i6));
        }
        return (Rect[]) arrayList.toArray(new Rect[arrayList.size()]);
    }

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    private C4384 m5221(int i, boolean z) {
        C4384 c4384M9389 = C4384.f16423;
        for (int i2 = 1; i2 <= 512; i2 <<= 1) {
            if ((i & i2) != 0) {
                C4384 c4384M5231 = m5231(i2, z);
                c4384M9389 = C4384.m9389(Math.max(c4384M9389.f16425, c4384M5231.f16425), Math.max(c4384M9389.f16426, c4384M5231.f16426), Math.max(c4384M9389.f16424, c4384M5231.f16424), Math.max(c4384M9389.f16427, c4384M5231.f16427));
            }
        }
        return c4384M9389;
    }

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    private static List<Rect> m5222(Rect[][] rectArr, int i) {
        Rect[] rectArr2;
        Rect[] rectArr3 = null;
        for (int i2 = 1; i2 <= 512; i2 <<= 1) {
            if ((i & i2) != 0 && (rectArr2 = rectArr[ᵲᵝᵪ.ᐧﾞ(i2)]) != null) {
                if (rectArr3 == null) {
                    rectArr3 = rectArr2;
                } else {
                    Rect[] rectArr4 = new Rect[rectArr3.length + rectArr2.length];
                    System.arraycopy(rectArr3, 0, rectArr4, 0, rectArr3.length);
                    System.arraycopy(rectArr2, 0, rectArr4, rectArr3.length, rectArr2.length);
                    rectArr3 = rectArr4;
                }
            }
        }
        return rectArr3 == null ? Collections.EMPTY_LIST : Arrays.asList(rectArr3);
    }

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    private C0740 m5223(View view) {
        Display display;
        if (view == null || (display = view.getDisplay()) == null) {
            return null;
        }
        Point point = new Point();
        display.getRealSize(point);
        if (this.f9326.f15918.mo5238()) {
            return C0740.m2794(point.x, point.y, true, 0, 0, 0, 0);
        }
        C4352 c4352M3336 = AbstractC0976.m3336(display, 0);
        C4352 c4352M33362 = AbstractC0976.m3336(display, 1);
        C4352 c4352M33363 = AbstractC0976.m3336(display, 2);
        C4352 c4352M33364 = AbstractC0976.m3336(display, 3);
        return C0740.m2794(point.x, point.y, false, c4352M3336 != null ? c4352M3336.f16293 : 0, c4352M33362 != null ? c4352M33362.f16293 : 0, c4352M33363 != null ? c4352M33363.f16293 : 0, c4352M33364 != null ? c4352M33364.f16293 : 0);
    }

    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    private C4384 m5224(View view) throws IllegalAccessException, ClassNotFoundException, SecurityException, IllegalArgumentException, InvocationTargetException {
        if (Build.VERSION.SDK_INT >= 30) {
            C0190.m1432("getVisibleInsets() should not be called on API >= 30. Use WindowInsets.isVisible() instead.");
            return null;
        }
        if (!f7481) {
            m5227();
        }
        Method method = f7480;
        if (method != null && f7482 != null && f7478 != null) {
            try {
                Object objInvoke = method.invoke(view, null);
                if (objInvoke == null) {
                    return null;
                }
                Rect rect = (Rect) f7478.get(f7479.get(objInvoke));
                if (rect != null) {
                    return C4384.m9389(rect.left, rect.top, rect.right, rect.bottom);
                }
                return null;
            } catch (ReflectiveOperationException e) {
                e.getMessage();
            }
        }
        return null;
    }

    /* renamed from: ᵮᵠـˌ, reason: contains not printable characters */
    private C4384 m5225() {
        C4250 c4250 = this.f7486;
        return c4250 != null ? c4250.f15918.mo3846() : C4384.f16423;
    }

    /* renamed from: ᵶʔᵢˊ, reason: contains not printable characters */
    public static boolean m5226(int i, int i2) {
        return (i & 6) == (i2 & 6);
    }

    /* renamed from: ᵺʙ, reason: contains not printable characters */
    private static void m5227() throws ClassNotFoundException, SecurityException {
        try {
            f7480 = View.class.getDeclaredMethod("getViewRootImpl", null);
            Class<?> cls = Class.forName("android.view.View$AttachInfo");
            f7482 = cls;
            f7478 = cls.getDeclaredField("mVisibleInsets");
            f7479 = Class.forName("android.view.ViewRootImpl").getDeclaredField("mAttachInfo");
            f7478.setAccessible(true);
            f7479.setAccessible(true);
        } catch (ReflectiveOperationException e) {
            e.getMessage();
        }
        f7481 = true;
    }

    @Override // defpackage.C2387
    public boolean equals(Object obj) {
        if (!super.equals(obj)) {
            return false;
        }
        AbstractC1850 abstractC1850 = (AbstractC1850) obj;
        return Objects.equals(this.f7485, abstractC1850.f7485) && m5226(this.f7491, abstractC1850.f7491);
    }

    @Override // defpackage.C2387
    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public List<Rect> mo5228(int i) {
        return m5222(this.f7490, i);
    }

    @Override // defpackage.C2387
    /* renamed from: ˌʾˀ */
    public C4250 mo4445(int i, int i2, int i3, int i4) {
        C4250 c4250M9194 = C4250.m9194(this.f7487, null);
        int i5 = Build.VERSION.SDK_INT;
        AbstractC0902 c2228 = i5 >= 36 ? new C2228(c4250M9194) : i5 >= 35 ? new C4510(c4250M9194) : i5 >= 34 ? new C4274(c4250M9194) : i5 >= 31 ? new C1100(c4250M9194) : i5 >= 30 ? new C1084(c4250M9194) : i5 >= 29 ? new C3850(c4250M9194) : new C4285(c4250M9194);
        c2228.mo3024(C4250.m9195(mo5229(), i, i2, i3, i4));
        c2228.mo3028(C4250.m9195(mo3846(), i, i2, i3, i4));
        return c2228.mo3027();
    }

    @Override // defpackage.C2387
    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public final C4384 mo5229() {
        if (this.f7483 == null) {
            WindowInsets windowInsets = this.f7487;
            this.f7483 = C4384.m9389(windowInsets.getSystemWindowInsetLeft(), windowInsets.getSystemWindowInsetTop(), windowInsets.getSystemWindowInsetRight(), windowInsets.getSystemWindowInsetBottom());
        }
        return this.f7483;
    }

    /* renamed from: ˎˑː */
    public C4384 mo2920(int i) {
        return m5221(i, true);
    }

    @Override // defpackage.C2387
    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public List<Rect> mo5230(int i) {
        return m5222(this.f7484, i);
    }

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public C4384 m5231(int i, boolean z) {
        C4384 c4384Mo3846;
        int i2;
        C4384 c4384 = C4384.f16423;
        if (i != 1) {
            if (i != 2) {
                if (i == 8) {
                    C4384[] c4384Arr = this.f7492;
                    c4384Mo3846 = c4384Arr != null ? c4384Arr[ᵲᵝᵪ.ᐧﾞ(8)] : null;
                    if (c4384Mo3846 != null) {
                        return c4384Mo3846;
                    }
                    C4384 c4384Mo5229 = mo5229();
                    C4384 c4384M5225 = m5225();
                    int i3 = c4384Mo5229.f16427;
                    if (i3 > c4384M5225.f16427) {
                        return C4384.m9389(0, 0, 0, i3);
                    }
                    C4384 c43842 = this.f7485;
                    if (c43842 != null && !c43842.equals(c4384) && (i2 = this.f7485.f16427) > c4384M5225.f16427) {
                        return C4384.m9389(0, 0, 0, i2);
                    }
                } else {
                    if (i == 16) {
                        return mo4448();
                    }
                    if (i == 32) {
                        return mo4446();
                    }
                    if (i == 64) {
                        return mo4447();
                    }
                    if (i == 128) {
                        C4250 c4250 = this.f7486;
                        C3074 c3074Mo2628 = c4250 != null ? c4250.f15918.mo2628() : mo2628();
                        if (c3074Mo2628 != null) {
                            int i4 = Build.VERSION.SDK_INT;
                            return C4384.m9389(i4 >= 28 ? AbstractC3502.m8003(c3074Mo2628.f11750) : 0, i4 >= 28 ? AbstractC3502.m7994(c3074Mo2628.f11750) : 0, i4 >= 28 ? AbstractC3502.m7986(c3074Mo2628.f11750) : 0, i4 >= 28 ? AbstractC3502.m8001(c3074Mo2628.f11750) : 0);
                        }
                    }
                }
            } else {
                if (z) {
                    C4384 c4384M52252 = m5225();
                    C4384 c4384Mo38462 = mo3846();
                    return C4384.m9389(Math.max(c4384M52252.f16425, c4384Mo38462.f16425), 0, Math.max(c4384M52252.f16424, c4384Mo38462.f16424), Math.max(c4384M52252.f16427, c4384Mo38462.f16427));
                }
                if ((this.f7491 & 2) == 0) {
                    C4384 c4384Mo52292 = mo5229();
                    C4250 c42502 = this.f7486;
                    c4384Mo3846 = c42502 != null ? c42502.f15918.mo3846() : null;
                    int iMin = c4384Mo52292.f16427;
                    if (c4384Mo3846 != null) {
                        iMin = Math.min(iMin, c4384Mo3846.f16427);
                    }
                    return C4384.m9389(c4384Mo52292.f16425, 0, c4384Mo52292.f16424, iMin);
                }
            }
        } else {
            if (z) {
                return C4384.m9389(0, Math.max(m5225().f16426, mo5229().f16426), 0, 0);
            }
            if ((this.f7491 & 4) == 0) {
                return C4384.m9389(0, mo5229().f16426, 0, 0);
            }
        }
        return c4384;
    }

    @Override // defpackage.C2387
    /* renamed from: ˑᵱ, reason: contains not printable characters */
    public void mo5232(C4250 c4250) {
        this.f7486 = c4250;
    }

    /* renamed from: ᐧﾞ, reason: contains not printable characters */
    public void m5233(C4384 c4384) {
        this.f7485 = c4384;
    }

    @Override // defpackage.C2387
    /* renamed from: ᵞʡ, reason: contains not printable characters */
    public void mo5234(C0740 c0740) {
    }

    @Override // defpackage.C2387
    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public void mo5235(int i) {
        this.f7491 = i;
    }

    @Override // defpackage.C2387
    /* renamed from: ᵨᵳʝ, reason: contains not printable characters */
    public void mo5236(C4384[] c4384Arr) {
        this.f7492 = c4384Arr;
    }

    @Override // defpackage.C2387
    /* renamed from: ᵪʩ */
    public void mo4531(View view) {
        m5223(view);
    }

    @Override // defpackage.C2387
    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public void mo5237() {
        for (int i = 1; i <= 512; i <<= 1) {
            int i2 = ᵲᵝᵪ.ᐧﾞ(i);
            this.f7490[i2] = m5220(mo2921(i));
            if (i != 8) {
                this.f7484[i2] = m5220(mo2920(i));
            }
        }
    }

    @Override // defpackage.C2387
    /* renamed from: ᵸʓᵠ, reason: contains not printable characters */
    public boolean mo5238() {
        return this.f7487.isRound();
    }

    @Override // defpackage.C2387
    /* renamed from: ᵹᵝᵶ */
    public C4384 mo2921(int i) {
        return m5221(i, false);
    }

    @Override // defpackage.C2387
    /* renamed from: ᵻᵢﹳᵰ */
    public void mo2922(View view) throws IllegalAccessException, ClassNotFoundException, SecurityException, IllegalArgumentException, InvocationTargetException {
        this.f7489 = view.getWidth();
        this.f7488 = view.getHeight();
        C4384 c4384M5224 = m5224(view);
        if (c4384M5224 == null) {
            c4384M5224 = C4384.f16423;
        }
        m5233(c4384M5224);
    }

    @Override // defpackage.C2387
    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public void mo5239(Rect[][] rectArr) {
        Objects.requireNonNull(rectArr);
        this.f7484 = (Rect[][]) rectArr.clone();
    }

    @Override // defpackage.C2387
    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public void mo5240(Rect[][] rectArr) {
        Objects.requireNonNull(rectArr);
        this.f7490 = (Rect[][]) rectArr.clone();
    }
}
