.class public final Lz5/ws1;
.super Landroid/view/Surface;
.source ""


# static fields
.field public static u:I

.field public static v:Z


# instance fields
.field public final r:Z

.field public final s:Lz5/vs1;

.field public t:Z


# direct methods
.method public synthetic constructor <init>(Lz5/vs1;Landroid/graphics/SurfaceTexture;Z)V
    .registers 4

    invoke-direct {p0, p2}, Landroid/view/Surface;-><init>(Landroid/graphics/SurfaceTexture;)V

    iput-object p1, p0, Lz5/ws1;->s:Lz5/vs1;

    iput-boolean p3, p0, Lz5/ws1;->r:Z

    return-void
.end method

.method public static declared-synchronized a(Landroid/content/Context;)Z
    .registers 9

    const-class v0, Lz5/ws1;

    monitor-enter v0

    :try_start_3
    sget-boolean v1, Lz5/ws1;->v:Z

    const/4 v2, 0x1

    const/4 v3, 0x0

    if-nez v1, :cond_6a

    sget v1, Lz5/r7;->a:I

    const/16 v4, 0x18

    const/4 v5, 0x2

    if-ge v1, v4, :cond_12

    :cond_10
    :goto_10
    move v5, v3

    goto :goto_66

    :cond_12
    const/16 v4, 0x1a

    if-ge v1, v4, :cond_2b

    const-string v6, "samsung"

    sget-object v7, Lz5/r7;->c:Ljava/lang/String;

    invoke-virtual {v6, v7}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-nez v6, :cond_10

    const-string v6, "XT1650"

    sget-object v7, Lz5/r7;->d:Ljava/lang/String;

    invoke-virtual {v6, v7}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-eqz v6, :cond_2b

    goto :goto_10

    :cond_2b
    if-ge v1, v4, :cond_3a

    invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object p0

    const-string v4, "android.hardware.vr.high_performance"

    invoke-virtual {p0, v4}, Landroid/content/pm/PackageManager;->hasSystemFeature(Ljava/lang/String;)Z

    move-result p0

    if-nez p0, :cond_3a

    goto :goto_10

    :cond_3a
    invoke-static {v3}, Landroid/opengl/EGL14;->eglGetDisplay(I)Landroid/opengl/EGLDisplay;

    move-result-object p0

    const/16 v4, 0x3055

    invoke-static {p0, v4}, Landroid/opengl/EGL14;->eglQueryString(Landroid/opengl/EGLDisplay;I)Ljava/lang/String;

    move-result-object p0

    if-eqz p0, :cond_10

    const-string v6, "EGL_EXT_protected_content"

    invoke-virtual {p0, v6}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result p0

    if-eqz p0, :cond_10

    const/16 p0, 0x11

    if-ge v1, p0, :cond_53

    goto :goto_66

    :cond_53
    invoke-static {v3}, Landroid/opengl/EGL14;->eglGetDisplay(I)Landroid/opengl/EGLDisplay;

    move-result-object p0

    invoke-static {p0, v4}, Landroid/opengl/EGL14;->eglQueryString(Landroid/opengl/EGLDisplay;I)Ljava/lang/String;

    move-result-object p0

    if-eqz p0, :cond_66

    const-string v1, "EGL_KHR_surfaceless_context"

    invoke-virtual {p0, v1}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result p0

    if-eqz p0, :cond_66

    move v5, v2

    :cond_66
    :goto_66
    sput v5, Lz5/ws1;->u:I

    sput-boolean v2, Lz5/ws1;->v:Z

    :cond_6a
    sget p0, Lz5/ws1;->u:I
    :try_end_6c
    .catchall {:try_start_3 .. :try_end_6c} :catchall_71

    monitor-exit v0

    if-eqz p0, :cond_70

    return v2

    :cond_70
    return v3

    :catchall_71
    move-exception p0

    monitor-exit v0

    throw p0
.end method

.method public static b(Landroid/content/Context;Z)Lz5/ws1;
    .registers 6

    const/4 v0, 0x0

    const/4 v1, 0x1

    if-eqz p1, :cond_d

    invoke-static {p0}, Lz5/ws1;->a(Landroid/content/Context;)Z

    move-result p0

    if-eqz p0, :cond_b

    goto :goto_d

    :cond_b
    move p0, v0

    goto :goto_e

    :cond_d
    :goto_d
    move p0, v1

    :goto_e
    invoke-static {p0}, Lcom/google/android/gms/internal/ads/d;->n(Z)V

    new-instance p0, Lz5/vs1;

    invoke-direct {p0}, Lz5/vs1;-><init>()V

    if-eqz p1, :cond_1b

    sget p1, Lz5/ws1;->u:I

    goto :goto_1c

    :cond_1b
    move p1, v0

    .line 1
    :goto_1c
    invoke-virtual {p0}, Landroid/os/HandlerThread;->start()V

    new-instance v2, Landroid/os/Handler;

    invoke-virtual {p0}, Landroid/os/HandlerThread;->getLooper()Landroid/os/Looper;

    move-result-object v3

    invoke-direct {v2, v3, p0}, Landroid/os/Handler;-><init>(Landroid/os/Looper;Landroid/os/Handler$Callback;)V

    iput-object v2, p0, Lz5/vs1;->s:Landroid/os/Handler;

    new-instance v3, Lz5/t6;

    invoke-direct {v3, v2}, Lz5/t6;-><init>(Landroid/os/Handler;)V

    iput-object v3, p0, Lz5/vs1;->r:Lz5/t6;

    monitor-enter p0

    :try_start_32
    iget-object v2, p0, Lz5/vs1;->s:Landroid/os/Handler;

    invoke-virtual {v2, v1, p1, v0}, Landroid/os/Handler;->obtainMessage(III)Landroid/os/Message;

    move-result-object p1

    invoke-virtual {p1}, Landroid/os/Message;->sendToTarget()V

    :goto_3b
    iget-object p1, p0, Lz5/vs1;->v:Lz5/ws1;

    if-nez p1, :cond_4d

    iget-object p1, p0, Lz5/vs1;->u:Ljava/lang/RuntimeException;

    if-nez p1, :cond_4d

    iget-object p1, p0, Lz5/vs1;->t:Ljava/lang/Error;
    :try_end_45
    .catchall {:try_start_32 .. :try_end_45} :catchall_67

    if-nez p1, :cond_4d

    :try_start_47
    invoke-virtual {p0}, Ljava/lang/Object;->wait()V
    :try_end_4a
    .catch Ljava/lang/InterruptedException; {:try_start_47 .. :try_end_4a} :catch_4b
    .catchall {:try_start_47 .. :try_end_4a} :catchall_67

    goto :goto_3b

    :catch_4b
    move v0, v1

    goto :goto_3b

    :cond_4d
    :try_start_4d
    monitor-exit p0
    :try_end_4e
    .catchall {:try_start_4d .. :try_end_4e} :catchall_67

    if-eqz v0, :cond_57

    invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;

    move-result-object p1

    invoke-virtual {p1}, Ljava/lang/Thread;->interrupt()V

    :cond_57
    iget-object p1, p0, Lz5/vs1;->u:Ljava/lang/RuntimeException;

    if-nez p1, :cond_66

    iget-object p1, p0, Lz5/vs1;->t:Ljava/lang/Error;

    if-nez p1, :cond_65

    iget-object p0, p0, Lz5/vs1;->v:Lz5/ws1;

    invoke-static {p0}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    return-object p0

    :cond_65
    throw p1

    :cond_66
    throw p1

    :catchall_67
    move-exception p1

    :try_start_68
    monitor-exit p0
    :try_end_69
    .catchall {:try_start_68 .. :try_end_69} :catchall_67

    throw p1
.end method


# virtual methods
.method public final release()V
    .registers 4

    invoke-super {p0}, Landroid/view/Surface;->release()V

    iget-object v0, p0, Lz5/ws1;->s:Lz5/vs1;

    monitor-enter v0

    :try_start_6
    iget-boolean v1, p0, Lz5/ws1;->t:Z

    if-nez v1, :cond_1b

    iget-object v1, p0, Lz5/ws1;->s:Lz5/vs1;

    .line 1
    iget-object v1, v1, Lz5/vs1;->s:Landroid/os/Handler;

    invoke-static {v1}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    const/4 v2, 0x2

    invoke-virtual {v1, v2}, Landroid/os/Handler;->sendEmptyMessage(I)Z

    const/4 v1, 0x1

    .line 2
    iput-boolean v1, p0, Lz5/ws1;->t:Z

    goto :goto_1b

    :catchall_19
    move-exception v1

    goto :goto_1d

    :cond_1b
    :goto_1b
    monitor-exit v0

    return-void

    :goto_1d
    monitor-exit v0
    :try_end_1e
    .catchall {:try_start_6 .. :try_end_1e} :catchall_19

    throw v1
.end method
