package M;

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 N extends S {

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

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

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

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

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public F.b f4081b;

    public N() {
        this.f4080a = e();
    }

    private static WindowInsets e() {
        if (!f4077d) {
            try {
                f4076c = WindowInsets.class.getDeclaredField("CONSUMED");
            } catch (ReflectiveOperationException e8) {
                Log.i("WindowInsetsCompat", "Could not retrieve WindowInsets.CONSUMED field", e8);
            }
            f4077d = true;
        }
        Field field = f4076c;
        if (field != null) {
            try {
                WindowInsets windowInsets = (WindowInsets) field.get(null);
                if (windowInsets != null) {
                    return new WindowInsets(windowInsets);
                }
            } catch (ReflectiveOperationException e9) {
                Log.i("WindowInsetsCompat", "Could not get value from WindowInsets.CONSUMED field", e9);
            }
        }
        if (!f4079f) {
            try {
                f4078e = WindowInsets.class.getConstructor(Rect.class);
            } catch (ReflectiveOperationException e10) {
                Log.i("WindowInsetsCompat", "Could not retrieve WindowInsets(Rect) constructor", e10);
            }
            f4079f = true;
        }
        Constructor constructor = f4078e;
        if (constructor != null) {
            try {
                return (WindowInsets) constructor.newInstance(new Rect());
            } catch (ReflectiveOperationException e11) {
                Log.i("WindowInsetsCompat", "Could not invoke WindowInsets(Rect) constructor", e11);
            }
        }
        return null;
    }

    @Override // M.S
    public b0 b() {
        a();
        b0 b0VarD = b0.d(this.f4080a, null);
        a0 a0Var = b0VarD.f4102a;
        a0Var.l(null);
        a0Var.n(this.f4081b);
        return b0VarD;
    }

    @Override // M.S
    public void c(F.b bVar) {
        this.f4081b = bVar;
    }

    @Override // M.S
    public void d(F.b bVar) {
        WindowInsets windowInsets = this.f4080a;
        if (windowInsets != null) {
            this.f4080a = windowInsets.replaceSystemWindowInsets(bVar.f2229a, bVar.f2230b, bVar.f2231c, bVar.f2232d);
        }
    }

    public N(b0 b0Var) {
        super(b0Var);
        this.f4080a = b0Var.c();
    }
}
