package defpackage;

import android.content.Context;
import android.graphics.SurfaceTexture;
import android.os.Build;
import android.view.Surface;
import androidx.media3.common.util.GlUtil$GlException;

/* renamed from: ᵖʨᵳʩ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C2340 extends Surface {

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public static boolean f9168;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public static int f9169;

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public final HandlerThreadC0064 f9170;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public final boolean f9171;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public boolean f9172;

    public C2340(HandlerThreadC0064 handlerThreadC0064, SurfaceTexture surfaceTexture, boolean z) {
        super(surfaceTexture);
        this.f9170 = handlerThreadC0064;
        this.f9171 = z;
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public static int m6059(Context context) {
        try {
            int i = Build.VERSION.SDK_INT;
            if ((i >= 24 && (i >= 26 || !("samsung".equals(Build.MANUFACTURER) || "XT1650".equals(Build.MODEL))) && (i >= 26 || context.getPackageManager().hasSystemFeature("android.hardware.vr.high_performance"))) ? ˉˇʨ.ᵧᵾˀˈ("EGL_EXT_protected_content") : false) {
                return ˉˇʨ.ᵧᵾˀˈ("EGL_KHR_surfaceless_context") ? 1 : 2;
            }
            return 0;
        } catch (GlUtil$GlException e) {
            ᵳʿˉ.ᵶᵷᵕ("Failed to determine secure mode due to GL error: " + e.getMessage());
            return 0;
        }
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public static synchronized boolean m6060(Context context) {
        try {
            if (!f9168) {
                f9169 = m6059(context);
                f9168 = true;
            }
        } catch (Throwable th) {
            throw th;
        }
        return f9169 != 0;
    }

    @Override // android.view.Surface
    public final void release() {
        super.release();
        synchronized (this.f9170) {
            try {
                if (!this.f9172) {
                    HandlerThreadC0064 handlerThreadC0064 = this.f9170;
                    handlerThreadC0064.f1284.getClass();
                    handlerThreadC0064.f1284.sendEmptyMessage(2);
                    this.f9172 = true;
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }
}
