package com.google.android.gms.internal.ads;

import android.content.Context;
import android.graphics.SurfaceTexture;
import android.os.Handler;
import android.view.Surface;

/* JADX INFO: loaded from: classes2.dex */
public final class t0 extends Surface {

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static int f16658d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public static boolean f16659e;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final boolean f16660a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final s0 f16661b;

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

    public /* synthetic */ t0(s0 s0Var, SurfaceTexture surfaceTexture, boolean z10) {
        super(surfaceTexture);
        this.f16661b = s0Var;
        this.f16660a = z10;
    }

    public static synchronized boolean a(Context context) {
        if (!f16659e) {
            try {
            } catch (zzdu e10) {
                vt0.d("Failed to determine secure mode due to GL error: ".concat(String.valueOf(e10.getMessage())));
            }
            int i10 = dq0.a(context) ? dq0.d("EGL_KHR_surfaceless_context") ? 1 : 2 : 0;
            f16658d = i10;
            f16659e = true;
        }
        return f16658d != 0;
    }

    @Override // android.view.Surface
    public final void release() {
        super.release();
        s0 s0Var = this.f16661b;
        synchronized (s0Var) {
            try {
                if (!this.f16662c) {
                    Handler handler = s0Var.f16270b;
                    handler.getClass();
                    handler.sendEmptyMessage(2);
                    this.f16662c = true;
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }
}
