package P;

import android.graphics.Rect;
import android.util.Log;
import android.view.WindowInsets;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;

/* JADX INFO: loaded from: classes.dex */
public final class c0 extends h0 {

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public static Field f2427e = null;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static boolean f2428f = false;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public static Constructor f2429g = null;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public static boolean f2430h = false;

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public G.b f2432d;

    public c0() {
        this.f2431c = i();
    }

    private static WindowInsets i() {
        if (!f2428f) {
            try {
                f2427e = WindowInsets.class.getDeclaredField("CONSUMED");
            } catch (ReflectiveOperationException e2) {
                Log.i("WindowInsetsCompat", "Could not retrieve WindowInsets.CONSUMED field", e2);
            }
            f2428f = true;
        }
        Field field = f2427e;
        if (field != null) {
            try {
                WindowInsets windowInsets = (WindowInsets) field.get(null);
                if (windowInsets != null) {
                    return new WindowInsets(windowInsets);
                }
            } catch (ReflectiveOperationException e6) {
                Log.i("WindowInsetsCompat", "Could not get value from WindowInsets.CONSUMED field", e6);
            }
        }
        if (!f2430h) {
            try {
                f2429g = WindowInsets.class.getConstructor(Rect.class);
            } catch (ReflectiveOperationException e7) {
                Log.i("WindowInsetsCompat", "Could not retrieve WindowInsets(Rect) constructor", e7);
            }
            f2430h = true;
        }
        Constructor constructor = f2429g;
        if (constructor != null) {
            try {
                return (WindowInsets) constructor.newInstance(new Rect());
            } catch (ReflectiveOperationException e8) {
                Log.i("WindowInsetsCompat", "Could not invoke WindowInsets(Rect) constructor", e8);
            }
        }
        return null;
    }

    @Override // P.h0
    public s0 b() {
        a();
        s0 s0VarD = s0.d(null, this.f2431c);
        G.b[] bVarArr = this.f2450b;
        p0 p0Var = s0VarD.f2486a;
        p0Var.p(bVarArr);
        p0Var.r(this.f2432d);
        return s0VarD;
    }

    @Override // P.h0
    public void e(G.b bVar) {
        this.f2432d = bVar;
    }

    @Override // P.h0
    public void g(G.b bVar) {
        WindowInsets windowInsets = this.f2431c;
        if (windowInsets != null) {
            this.f2431c = windowInsets.replaceSystemWindowInsets(bVar.f759a, bVar.f760b, bVar.f761c, bVar.f762d);
        }
    }

    public c0(s0 s0Var) {
        super(s0Var);
        this.f2431c = s0Var.c();
    }
}
