DummySurface$DummySurfaceThread.smali
.class Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;
.super Landroid/os/HandlerThread;
# interfaces
.implements Landroid/os/Handler$Callback;
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/kwai/video/player/surface/DummySurface;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0xa
name = "DummySurfaceThread"
.end annotation
# static fields
.field private static final MSG_INIT:I = 0x1
.field private static final MSG_RELEASE:I = 0x2
# instance fields
.field private eglSurfaceTexture:Lcom/kwai/video/player/surface/EGLSurfaceTexture;
.annotation build Landroid/support/annotation/NonNull;
.end annotation
.end field
.field private handler:Landroid/os/Handler;
.annotation build Landroid/support/annotation/NonNull;
.end annotation
.end field
.field private initError:Ljava/lang/Error;
.annotation build Landroid/support/annotation/Nullable;
.end annotation
.end field
.field private initException:Ljava/lang/RuntimeException;
.annotation build Landroid/support/annotation/Nullable;
.end annotation
.end field
.field private surface:Lcom/kwai/video/player/surface/DummySurface;
.annotation build Landroid/support/annotation/Nullable;
.end annotation
.end field
# direct methods
.method public constructor <init>()V
.registers 2
const-string v0, "dummySurface"
invoke-direct {p0, v0}, Landroid/os/HandlerThread;-><init>(Ljava/lang/String;)V
return-void
.end method
.method private initInternal(I)V
.registers 6
iget-object v0, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->eglSurfaceTexture:Lcom/kwai/video/player/surface/EGLSurfaceTexture;
invoke-static {v0}, Lcom/kwai/video/player/surface/Assertions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
iget-object v0, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->eglSurfaceTexture:Lcom/kwai/video/player/surface/EGLSurfaceTexture;
invoke-virtual {v0, p1}, Lcom/kwai/video/player/surface/EGLSurfaceTexture;->init(I)V
new-instance v1, Lcom/kwai/video/player/surface/DummySurface;
iget-object v0, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->eglSurfaceTexture:Lcom/kwai/video/player/surface/EGLSurfaceTexture;
invoke-virtual {v0}, Lcom/kwai/video/player/surface/EGLSurfaceTexture;->getSurfaceTexture()Landroid/graphics/SurfaceTexture;
move-result-object v2
if-eqz p1, :cond_1c
const/4 v0, 0x1
:goto_15
const/4 v3, 0x0
invoke-direct {v1, p0, v2, v0, v3}, Lcom/kwai/video/player/surface/DummySurface;-><init>(Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;Landroid/graphics/SurfaceTexture;ZLcom/kwai/video/player/surface/DummySurface$1;)V
iput-object v1, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->surface:Lcom/kwai/video/player/surface/DummySurface;
return-void
:cond_1c
const/4 v0, 0x0
goto :goto_15
.end method
.method private releaseInternal()V
.registers 2
iget-object v0, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->eglSurfaceTexture:Lcom/kwai/video/player/surface/EGLSurfaceTexture;
invoke-static {v0}, Lcom/kwai/video/player/surface/Assertions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
iget-object v0, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->eglSurfaceTexture:Lcom/kwai/video/player/surface/EGLSurfaceTexture;
invoke-virtual {v0}, Lcom/kwai/video/player/surface/EGLSurfaceTexture;->release()V
return-void
.end method
# virtual methods
.method public handleMessage(Landroid/os/Message;)Z
.registers 6
const/4 v3, 0x1
iget v0, p1, Landroid/os/Message;->what:I
packed-switch v0, :pswitch_data_5e
:goto_6
return v3
:pswitch_7
:try_start_7
iget v0, p1, Landroid/os/Message;->arg1:I
invoke-direct {p0, v0}, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->initInternal(I)V
:try_end_c
.catch Ljava/lang/RuntimeException; {:try_start_7 .. :try_end_c} :catch_15
.catch Ljava/lang/Error; {:try_start_7 .. :try_end_c} :catch_28
.catchall {:try_start_7 .. :try_end_c} :catchall_3b
monitor-enter p0
:try_start_d
invoke-virtual {p0}, Ljava/lang/Object;->notify()V
monitor-exit p0
goto :goto_6
:catchall_12
move-exception v0
monitor-exit p0
:try_end_14
.catchall {:try_start_d .. :try_end_14} :catchall_12
throw v0
:catch_15
move-exception v0
:try_start_16
const-string v1, "DummySurface"
const-string v2, "Failed to initialize dummy surface"
invoke-static {v1, v2, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
iput-object v0, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->initException:Ljava/lang/RuntimeException;
:try_end_1f
.catchall {:try_start_16 .. :try_end_1f} :catchall_3b
monitor-enter p0
:try_start_20
invoke-virtual {p0}, Ljava/lang/Object;->notify()V
monitor-exit p0
goto :goto_6
:catchall_25
move-exception v0
monitor-exit p0
:try_end_27
.catchall {:try_start_20 .. :try_end_27} :catchall_25
throw v0
:catch_28
move-exception v0
:try_start_29
const-string v1, "DummySurface"
const-string v2, "Failed to initialize dummy surface"
invoke-static {v1, v2, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
iput-object v0, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->initError:Ljava/lang/Error;
:try_end_32
.catchall {:try_start_29 .. :try_end_32} :catchall_3b
monitor-enter p0
:try_start_33
invoke-virtual {p0}, Ljava/lang/Object;->notify()V
monitor-exit p0
goto :goto_6
:catchall_38
move-exception v0
monitor-exit p0
:try_end_3a
.catchall {:try_start_33 .. :try_end_3a} :catchall_38
throw v0
:catchall_3b
move-exception v0
monitor-enter p0
:try_start_3d
invoke-virtual {p0}, Ljava/lang/Object;->notify()V
monitor-exit p0
:try_end_41
.catchall {:try_start_3d .. :try_end_41} :catchall_42
throw v0
:catchall_42
move-exception v0
:try_start_43
monitor-exit p0
:try_end_44
.catchall {:try_start_43 .. :try_end_44} :catchall_42
throw v0
:pswitch_45
:try_start_45
invoke-direct {p0}, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->releaseInternal()V
:try_end_48
.catch Ljava/lang/Throwable; {:try_start_45 .. :try_end_48} :catch_4c
.catchall {:try_start_45 .. :try_end_48} :catchall_58
invoke-virtual {p0}, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->quit()Z
goto :goto_6
:catch_4c
move-exception v0
:try_start_4d
const-string v1, "DummySurface"
const-string v2, "Failed to release dummy surface"
invoke-static {v1, v2, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:try_end_54
.catchall {:try_start_4d .. :try_end_54} :catchall_58
invoke-virtual {p0}, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->quit()Z
goto :goto_6
:catchall_58
move-exception v0
invoke-virtual {p0}, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->quit()Z
throw v0
nop
:pswitch_data_5e
.packed-switch 0x1
:pswitch_7
:pswitch_45
.end packed-switch
.end method
.method public init(I)Lcom/kwai/video/player/surface/DummySurface;
.registers 7
const/4 v1, 0x1
const/4 v0, 0x0
invoke-virtual {p0}, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->start()V
new-instance v2, Landroid/os/Handler;
invoke-virtual {p0}, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->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, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->handler:Landroid/os/Handler;
new-instance v2, Lcom/kwai/video/player/surface/EGLSurfaceTexture;
iget-object v3, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->handler:Landroid/os/Handler;
invoke-direct {v2, v3}, Lcom/kwai/video/player/surface/EGLSurfaceTexture;-><init>(Landroid/os/Handler;)V
iput-object v2, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->eglSurfaceTexture:Lcom/kwai/video/player/surface/EGLSurfaceTexture;
monitor-enter p0
:try_start_1a
iget-object v2, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->handler:Landroid/os/Handler;
const/4 v3, 0x1
const/4 v4, 0x0
invoke-virtual {v2, v3, p1, v4}, Landroid/os/Handler;->obtainMessage(III)Landroid/os/Message;
move-result-object v2
invoke-virtual {v2}, Landroid/os/Message;->sendToTarget()V
:goto_25
iget-object v2, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->surface:Lcom/kwai/video/player/surface/DummySurface;
if-nez v2, :cond_38
iget-object v2, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->initException:Ljava/lang/RuntimeException;
if-nez v2, :cond_38
iget-object v2, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->initError:Ljava/lang/Error;
:try_end_2f
.catchall {:try_start_1a .. :try_end_2f} :catchall_49
if-nez v2, :cond_38
:try_start_31
invoke-virtual {p0}, Ljava/lang/Object;->wait()V
:try_end_34
.catch Ljava/lang/InterruptedException; {:try_start_31 .. :try_end_34} :catch_35
.catchall {:try_start_31 .. :try_end_34} :catchall_49
goto :goto_25
:catch_35
move-exception v0
move v0, v1
goto :goto_25
:cond_38
:try_start_38
monitor-exit p0
:try_end_39
.catchall {:try_start_38 .. :try_end_39} :catchall_49
if-eqz v0, :cond_42
invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/Thread;->interrupt()V
:cond_42
iget-object v0, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->initException:Ljava/lang/RuntimeException;
if-eqz v0, :cond_4c
iget-object v0, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->initException:Ljava/lang/RuntimeException;
throw v0
:catchall_49
move-exception v0
:try_start_4a
monitor-exit p0
:try_end_4b
.catchall {:try_start_4a .. :try_end_4b} :catchall_49
throw v0
:cond_4c
iget-object v0, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->initError:Ljava/lang/Error;
if-eqz v0, :cond_53
iget-object v0, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->initError:Ljava/lang/Error;
throw v0
:cond_53
iget-object v0, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->surface:Lcom/kwai/video/player/surface/DummySurface;
invoke-static {v0}, Lcom/kwai/video/player/surface/Assertions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/kwai/video/player/surface/DummySurface;
return-object v0
.end method
.method public release()V
.registers 3
iget-object v0, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->handler:Landroid/os/Handler;
invoke-static {v0}, Lcom/kwai/video/player/surface/Assertions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
iget-object v0, p0, Lcom/kwai/video/player/surface/DummySurface$DummySurfaceThread;->handler:Landroid/os/Handler;
const/4 v1, 0x2
invoke-virtual {v0, v1}, Landroid/os/Handler;->sendEmptyMessage(I)Z
return-void
.end method