package p0;

import J0.h1;
import android.content.Context;
import android.os.Build;
import com.debridstream.tv.R;
import r0.C2863b;
import t0.AbstractC2943a;
import t0.C2944b;

/* JADX INFO: renamed from: p0.e, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C2699e implements InterfaceC2684B {

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

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final J0.A f22912a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final Object f22913b = new Object();

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public boolean f22915d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final ComponentCallbacks2C2698d f22916e;

    public C2699e(J0.A a6) {
        this.f22912a = a6;
        ComponentCallbacks2C2698d componentCallbacks2C2698d = new ComponentCallbacks2C2698d(this);
        this.f22916e = componentCallbacks2C2698d;
        if (a6.isAttachedToWindow()) {
            Context context = a6.getContext();
            if (!this.f22915d) {
                context.getApplicationContext().registerComponentCallbacks(componentCallbacks2C2698d);
                this.f22915d = true;
            }
        }
        a6.addOnAttachStateChangeListener(new h1(this, 2));
    }

    @Override // p0.InterfaceC2684B
    public final void a(s0.b bVar) {
        synchronized (this.f22913b) {
            if (!bVar.f24038s) {
                bVar.f24038s = true;
                bVar.b();
            }
        }
    }

    @Override // p0.InterfaceC2684B
    public final s0.b b() {
        s0.d iVar;
        s0.b bVar;
        synchronized (this.f22913b) {
            try {
                J0.A a6 = this.f22912a;
                int i6 = Build.VERSION.SDK_INT;
                if (i6 >= 29) {
                    a6.getUniqueDrawingId();
                }
                if (i6 >= 29) {
                    iVar = new s0.g();
                } else if (f22911f) {
                    try {
                        iVar = new s0.e(this.f22912a, new C2713t(), new C2863b());
                    } catch (Throwable unused) {
                        f22911f = false;
                        iVar = new s0.i(c(this.f22912a));
                    }
                } else {
                    iVar = new s0.i(c(this.f22912a));
                }
                bVar = new s0.b(iVar);
            } catch (Throwable th) {
                throw th;
            }
        }
        return bVar;
    }

    public final AbstractC2943a c(J0.A a6) {
        C2944b c2944b = this.f22914c;
        if (c2944b != null) {
            return c2944b;
        }
        C2944b c2944b2 = new C2944b(a6.getContext());
        c2944b2.setClipChildren(false);
        c2944b2.setClipToPadding(false);
        c2944b2.setTag(R.id.hide_graphics_layer_in_inspector_tag, Boolean.TRUE);
        a6.addView(c2944b2, -1);
        this.f22914c = c2944b2;
        return c2944b2;
    }
}
