a.smali
.class public final Lcom/cmcm/qrcodelib/a/a;
.super Ljava/lang/Object;
.source "BeepVibrateManager.java"
# interfaces
.implements Landroid/media/MediaPlayer$OnErrorListener;
# instance fields
.field private Mc:Lcom/cmcm/qrcodelib/a/f;
.field private Md:Landroid/media/MediaPlayer;
.field private final mContext:Landroid/content/Context;
# direct methods
.method static constructor <clinit>()V
.registers 1
.prologue
.line 37
const-class v0, Lcom/cmcm/qrcodelib/a/a;
invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
return-void
.end method
.method public constructor <init>(Landroid/content/Context;Lcom/cmcm/qrcodelib/a/f;)V
.registers 3
.prologue
.line 42
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 43
iput-object p1, p0, Lcom/cmcm/qrcodelib/a/a;->mContext:Landroid/content/Context;
.line 44
iput-object p2, p0, Lcom/cmcm/qrcodelib/a/a;->Mc:Lcom/cmcm/qrcodelib/a/f;
.line 45
invoke-direct {p0}, Lcom/cmcm/qrcodelib/a/a;->fo()V
.line 46
return-void
.end method
.method private declared-synchronized fo()V
.registers 2
.prologue
.line 57
monitor-enter p0
:try_start_1
invoke-direct {p0}, Lcom/cmcm/qrcodelib/a/a;->fs()Z
move-result v0
if-eqz v0, :cond_11
.line 58
iget-object v0, p0, Lcom/cmcm/qrcodelib/a/a;->Md:Landroid/media/MediaPlayer;
if-nez v0, :cond_11
.line 59
invoke-direct {p0}, Lcom/cmcm/qrcodelib/a/a;->ft()Landroid/media/MediaPlayer;
move-result-object v0
iput-object v0, p0, Lcom/cmcm/qrcodelib/a/a;->Md:Landroid/media/MediaPlayer;
:try_end_11
.catchall {:try_start_1 .. :try_end_11} :catchall_13
.line 62
:cond_11
monitor-exit p0
return-void
.line 57
:catchall_13
move-exception v0
monitor-exit p0
throw v0
.end method
.method private declared-synchronized fp()Lcom/cmcm/qrcodelib/a/e;
.registers 2
.prologue
.line 65
monitor-enter p0
:try_start_1
iget-object v0, p0, Lcom/cmcm/qrcodelib/a/a;->Mc:Lcom/cmcm/qrcodelib/a/f;
:try_end_3
.catchall {:try_start_1 .. :try_end_3} :catchall_f
if-nez v0, :cond_8
const/4 v0, 0x0
:goto_6
monitor-exit p0
return-object v0
:cond_8
:try_start_8
iget-object v0, p0, Lcom/cmcm/qrcodelib/a/a;->Mc:Lcom/cmcm/qrcodelib/a/f;
invoke-interface {v0}, Lcom/cmcm/qrcodelib/a/f;->fp()Lcom/cmcm/qrcodelib/a/e;
:try_end_d
.catchall {:try_start_8 .. :try_end_d} :catchall_f
move-result-object v0
goto :goto_6
:catchall_f
move-exception v0
monitor-exit p0
throw v0
.end method
.method private declared-synchronized fq()Lcom/cmcm/qrcodelib/a/g;
.registers 2
.prologue
.line 69
monitor-enter p0
:try_start_1
iget-object v0, p0, Lcom/cmcm/qrcodelib/a/a;->Mc:Lcom/cmcm/qrcodelib/a/f;
:try_end_3
.catchall {:try_start_1 .. :try_end_3} :catchall_f
if-nez v0, :cond_8
const/4 v0, 0x0
:goto_6
monitor-exit p0
return-object v0
:cond_8
:try_start_8
iget-object v0, p0, Lcom/cmcm/qrcodelib/a/a;->Mc:Lcom/cmcm/qrcodelib/a/f;
invoke-interface {v0}, Lcom/cmcm/qrcodelib/a/f;->fq()Lcom/cmcm/qrcodelib/a/g;
:try_end_d
.catchall {:try_start_8 .. :try_end_d} :catchall_f
move-result-object v0
goto :goto_6
:catchall_f
move-exception v0
monitor-exit p0
throw v0
.end method
.method private fs()Z
.registers 4
.prologue
const/4 v1, 0x0
.line 83
invoke-direct {p0}, Lcom/cmcm/qrcodelib/a/a;->fp()Lcom/cmcm/qrcodelib/a/e;
move-result-object v0
.line 84
if-nez v0, :cond_9
move v0, v1
.line 97
:goto_8
return v0
.line 92
:cond_9
invoke-interface {v0}, Lcom/cmcm/qrcodelib/a/e;->fv()I
move-result v0
if-gtz v0, :cond_11
move v0, v1
.line 94
goto :goto_8
.line 96
:cond_11
iget-object v0, p0, Lcom/cmcm/qrcodelib/a/a;->mContext:Landroid/content/Context;
const-string v2, "audio"
invoke-virtual {v0, v2}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/media/AudioManager;
.line 97
if-eqz v0, :cond_26
invoke-virtual {v0}, Landroid/media/AudioManager;->getRingerMode()I
move-result v0
const/4 v2, 0x2
if-ne v0, v2, :cond_26
const/4 v0, 0x1
goto :goto_8
:cond_26
move v0, v1
goto :goto_8
.end method
.method private ft()Landroid/media/MediaPlayer;
.registers 9
.prologue
const/4 v6, 0x0
.line 110
invoke-direct {p0}, Lcom/cmcm/qrcodelib/a/a;->fp()Lcom/cmcm/qrcodelib/a/e;
move-result-object v0
.line 111
if-nez v0, :cond_9
move-object v0, v6
.line 136
:cond_8
:goto_8
return-object v0
.line 115
:cond_9
invoke-interface {v0}, Lcom/cmcm/qrcodelib/a/e;->fv()I
move-result v1
.line 116
if-gtz v1, :cond_11
move-object v0, v6
.line 118
goto :goto_8
.line 122
:cond_11
new-instance v0, Landroid/media/MediaPlayer;
invoke-direct {v0}, Landroid/media/MediaPlayer;-><init>()V
.line 125
:try_start_16
iget-object v2, p0, Lcom/cmcm/qrcodelib/a/a;->mContext:Landroid/content/Context;
invoke-virtual {v2}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v2
invoke-virtual {v2, v1}, Landroid/content/res/Resources;->openRawResourceFd(I)Landroid/content/res/AssetFileDescriptor;
:try_end_1f
.catch Ljava/io/IOException; {:try_start_16 .. :try_end_1f} :catch_51
.catchall {:try_start_16 .. :try_end_1f} :catchall_70
move-result-object v7
.line 126
:try_start_20
invoke-virtual {v7}, Landroid/content/res/AssetFileDescriptor;->getFileDescriptor()Ljava/io/FileDescriptor;
move-result-object v1
invoke-virtual {v7}, Landroid/content/res/AssetFileDescriptor;->getStartOffset()J
move-result-wide v2
invoke-virtual {v7}, Landroid/content/res/AssetFileDescriptor;->getLength()J
move-result-wide v4
invoke-virtual/range {v0 .. v5}, Landroid/media/MediaPlayer;->setDataSource(Ljava/io/FileDescriptor;JJ)V
.line 127
invoke-virtual {v0, p0}, Landroid/media/MediaPlayer;->setOnErrorListener(Landroid/media/MediaPlayer$OnErrorListener;)V
.line 128
const/4 v1, 0x3
invoke-virtual {v0, v1}, Landroid/media/MediaPlayer;->setAudioStreamType(I)V
.line 129
const/4 v1, 0x0
invoke-virtual {v0, v1}, Landroid/media/MediaPlayer;->setLooping(Z)V
.line 130
const v1, 0x3dcccccd # 0.1f
const v2, 0x3dcccccd # 0.1f
invoke-virtual {v0, v1, v2}, Landroid/media/MediaPlayer;->setVolume(FF)V
.line 131
invoke-virtual {v0}, Landroid/media/MediaPlayer;->prepare()V
:try_end_46
.catch Ljava/io/IOException; {:try_start_20 .. :try_end_46} :catch_82
.catchall {:try_start_20 .. :try_end_46} :catchall_7d
.line 138
if-eqz v7, :cond_8
.line 140
:try_start_48
invoke-virtual {v7}, Landroid/content/res/AssetFileDescriptor;->close()V
:try_end_4b
.catch Ljava/io/IOException; {:try_start_48 .. :try_end_4b} :catch_4c
goto :goto_8
.line 142
:catch_4c
move-exception v1
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V
goto :goto_8
.line 133
:catch_51
move-exception v1
move-object v2, v6
.line 134
:goto_53
:try_start_53
invoke-virtual {v0}, Landroid/media/MediaPlayer;->release()V
.line 135
new-instance v0, Ljava/lang/StringBuilder;
const-string v3, "createBeepSoundPlayer:failed, cause exception: "
invoke-direct {v0, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {v1}, Ljava/io/IOException;->getMessage()Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
:try_end_64
.catchall {:try_start_53 .. :try_end_64} :catchall_7f
.line 138
if-eqz v2, :cond_69
.line 140
:try_start_66
invoke-virtual {v2}, Landroid/content/res/AssetFileDescriptor;->close()V
:try_end_69
.catch Ljava/io/IOException; {:try_start_66 .. :try_end_69} :catch_6b
:cond_69
:goto_69
move-object v0, v6
.line 136
goto :goto_8
.line 142
:catch_6b
move-exception v0
invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V
goto :goto_69
.line 138
:catchall_70
move-exception v0
move-object v7, v6
:goto_72
if-eqz v7, :cond_77
.line 140
:try_start_74
invoke-virtual {v7}, Landroid/content/res/AssetFileDescriptor;->close()V
:try_end_77
.catch Ljava/io/IOException; {:try_start_74 .. :try_end_77} :catch_78
.line 143
:cond_77
:goto_77
throw v0
.line 142
:catch_78
move-exception v1
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V
goto :goto_77
.line 138
:catchall_7d
move-exception v0
goto :goto_72
:catchall_7f
move-exception v0
move-object v7, v2
goto :goto_72
.line 133
:catch_82
move-exception v1
move-object v2, v7
goto :goto_53
.end method
.method private declared-synchronized fu()V
.registers 2
.prologue
.line 149
monitor-enter p0
:try_start_1
iget-object v0, p0, Lcom/cmcm/qrcodelib/a/a;->Md:Landroid/media/MediaPlayer;
if-eqz v0, :cond_1a
.line 150
iget-object v0, p0, Lcom/cmcm/qrcodelib/a/a;->Md:Landroid/media/MediaPlayer;
invoke-virtual {v0}, Landroid/media/MediaPlayer;->isPlaying()Z
move-result v0
if-eqz v0, :cond_12
.line 151
iget-object v0, p0, Lcom/cmcm/qrcodelib/a/a;->Md:Landroid/media/MediaPlayer;
invoke-virtual {v0}, Landroid/media/MediaPlayer;->stop()V
.line 153
:cond_12
iget-object v0, p0, Lcom/cmcm/qrcodelib/a/a;->Md:Landroid/media/MediaPlayer;
invoke-virtual {v0}, Landroid/media/MediaPlayer;->release()V
.line 154
const/4 v0, 0x0
iput-object v0, p0, Lcom/cmcm/qrcodelib/a/a;->Md:Landroid/media/MediaPlayer;
:try_end_1a
.catchall {:try_start_1 .. :try_end_1a} :catchall_1c
.line 156
:cond_1a
monitor-exit p0
return-void
.line 149
:catchall_1c
move-exception v0
monitor-exit p0
throw v0
.end method
# virtual methods
.method public final declared-synchronized a(Lcom/cmcm/qrcodelib/a/f;)V
.registers 3
.prologue
.line 159
monitor-enter p0
:try_start_1
iget-object v0, p0, Lcom/cmcm/qrcodelib/a/a;->Mc:Lcom/cmcm/qrcodelib/a/f;
:try_end_3
.catchall {:try_start_1 .. :try_end_3} :catchall_a
if-ne v0, p1, :cond_7
.line 163
:goto_5
monitor-exit p0
return-void
.line 162
:cond_7
:try_start_7
iput-object p1, p0, Lcom/cmcm/qrcodelib/a/a;->Mc:Lcom/cmcm/qrcodelib/a/f;
:try_end_9
.catchall {:try_start_7 .. :try_end_9} :catchall_a
goto :goto_5
.line 159
:catchall_a
move-exception v0
monitor-exit p0
throw v0
.end method
.method public final declared-synchronized fr()V
.registers 5
.prologue
.line 73
monitor-enter p0
:try_start_1
invoke-direct {p0}, Lcom/cmcm/qrcodelib/a/a;->fs()Z
move-result v0
if-eqz v0, :cond_10
iget-object v0, p0, Lcom/cmcm/qrcodelib/a/a;->Md:Landroid/media/MediaPlayer;
if-eqz v0, :cond_10
.line 74
iget-object v0, p0, Lcom/cmcm/qrcodelib/a/a;->Md:Landroid/media/MediaPlayer;
invoke-virtual {v0}, Landroid/media/MediaPlayer;->start()V
.line 1101
:cond_10
invoke-direct {p0}, Lcom/cmcm/qrcodelib/a/a;->fq()Lcom/cmcm/qrcodelib/a/g;
move-result-object v0
.line 1102
if-nez v0, :cond_2d
.line 1104
const/4 v0, 0x0
.line 76
:goto_17
if-eqz v0, :cond_2b
.line 77
iget-object v0, p0, Lcom/cmcm/qrcodelib/a/a;->mContext:Landroid/content/Context;
const-string v1, "vibrator"
invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/os/Vibrator;
.line 78
invoke-direct {p0}, Lcom/cmcm/qrcodelib/a/a;->fq()Lcom/cmcm/qrcodelib/a/g;
const-wide/16 v2, 0xc8
invoke-virtual {v0, v2, v3}, Landroid/os/Vibrator;->vibrate(J)V
:try_end_2b
.catchall {:try_start_1 .. :try_end_2b} :catchall_2f
.line 80
:cond_2b
monitor-exit p0
return-void
.line 1106
:cond_2d
const/4 v0, 0x1
goto :goto_17
.line 73
:catchall_2f
move-exception v0
monitor-exit p0
throw v0
.end method
.method public final declared-synchronized onError(Landroid/media/MediaPlayer;II)Z
.registers 5
.prologue
.line 167
monitor-enter p0
:try_start_1
invoke-direct {p0}, Lcom/cmcm/qrcodelib/a/a;->fu()V
:try_end_4
.catchall {:try_start_1 .. :try_end_4} :catchall_7
.line 168
const/4 v0, 0x1
monitor-exit p0
return v0
.line 167
:catchall_7
move-exception v0
monitor-exit p0
throw v0
.end method
.method public final declared-synchronized onPause()V
.registers 2
.prologue
.line 53
monitor-enter p0
:try_start_1
invoke-direct {p0}, Lcom/cmcm/qrcodelib/a/a;->fu()V
:try_end_4
.catchall {:try_start_1 .. :try_end_4} :catchall_6
.line 54
monitor-exit p0
return-void
.line 53
:catchall_6
move-exception v0
monitor-exit p0
throw v0
.end method
.method public final declared-synchronized onResume()V
.registers 2
.prologue
.line 49
monitor-enter p0
:try_start_1
invoke-direct {p0}, Lcom/cmcm/qrcodelib/a/a;->fo()V
:try_end_4
.catchall {:try_start_1 .. :try_end_4} :catchall_6
.line 50
monitor-exit p0
return-void
.line 49
:catchall_6
move-exception v0
monitor-exit p0
throw v0
.end method