SpeakerVerifierImpl.smali

.class public Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;
.super Lcom/iflytek/thirdparty/w;
.source "SourceFile"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl$InternalListener;
    }
.end annotation


# static fields
.field private static final allChar:Ljava/lang/String; = "023456789"


# instance fields
.field private mRequestFocus:Z


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 3

    .prologue
    .line 39
    invoke-direct {p0, p1}, Lcom/iflytek/thirdparty/w;-><init>(Landroid/content/Context;)V

    .line 31
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mRequestFocus:Z

    .line 40
    return-void
.end method

.method static synthetic access$100(Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;)Lcom/iflytek/thirdparty/s;
    .registers 2

    .prologue
    .line 28
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mscer:Lcom/iflytek/thirdparty/s;

    return-object v0
.end method

.method static synthetic access$200(Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;)Lcom/iflytek/thirdparty/s;
    .registers 2

    .prologue
    .line 28
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mscer:Lcom/iflytek/thirdparty/s;

    return-object v0
.end method

.method static synthetic access$300(Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;)Lcom/iflytek/thirdparty/s;
    .registers 2

    .prologue
    .line 28
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mscer:Lcom/iflytek/thirdparty/s;

    return-object v0
.end method

.method static synthetic access$400(Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;)Lcom/iflytek/thirdparty/s;
    .registers 2

    .prologue
    .line 28
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mscer:Lcom/iflytek/thirdparty/s;

    return-object v0
.end method

.method static synthetic access$500(Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;)Lcom/iflytek/thirdparty/s;
    .registers 2

    .prologue
    .line 28
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mscer:Lcom/iflytek/thirdparty/s;

    return-object v0
.end method

.method static synthetic access$600(Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;)Landroid/content/Context;
    .registers 2

    .prologue
    .line 28
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mContext:Landroid/content/Context;

    return-object v0
.end method

.method static synthetic access$700(Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;)Z
    .registers 2

    .prologue
    .line 28
    iget-boolean v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mRequestFocus:Z

    return v0
.end method


# virtual methods
.method public generatePassword(I)Ljava/lang/String;
    .registers 9

    .prologue
    const/4 v3, 0x0

    .line 104
    new-instance v4, Ljava/lang/StringBuffer;

    invoke-direct {v4}, Ljava/lang/StringBuffer;-><init>()V

    .line 105
    new-instance v5, Ljava/security/SecureRandom;

    invoke-direct {v5}, Ljava/security/SecureRandom;-><init>()V

    .line 107
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "023456789"

    const-string v2, "023456789"

    invoke-virtual {v2}, Ljava/lang/String;->length()I

    move-result v2

    invoke-virtual {v5, v2}, Ljava/security/SecureRandom;->nextInt(I)I

    move-result v2

    invoke-virtual {v1, v2}, Ljava/lang/String;->charAt(I)C

    move-result v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, ""

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 108
    invoke-virtual {v4, v1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move v2, v3

    .line 111
    :goto_32
    add-int/lit8 v0, p1, -0x1

    if-ge v2, v0, :cond_aa

    .line 112
    invoke-static {v3}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v0

    .line 113
    :goto_3a
    invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v0

    if-nez v0, :cond_a3

    .line 114
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "023456789"

    const-string v6, "023456789"

    invoke-virtual {v6}, Ljava/lang/String;->length()I

    move-result v6

    invoke-virtual {v5, v6}, Ljava/security/SecureRandom;->nextInt(I)I

    move-result v6

    invoke-virtual {v1, v6}, Ljava/lang/String;->charAt(I)C

    move-result v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, ""

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 115
    invoke-virtual {v4, v1}, Ljava/lang/StringBuffer;->indexOf(Ljava/lang/String;)I

    move-result v0

    if-ltz v0, :cond_6e

    .line 117
    invoke-static {v3}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v0

    goto :goto_3a

    .line 120
    :cond_6e
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v4}, Ljava/lang/StringBuffer;->length()I

    move-result v6

    add-int/lit8 v6, v6, -0x1

    invoke-virtual {v4, v6}, Ljava/lang/StringBuffer;->charAt(I)C

    move-result v6

    invoke-virtual {v0, v6}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v6, ""

    invoke-virtual {v0, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v0

    invoke-static {v1}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v6

    mul-int/2addr v0, v6

    const/16 v6, 0xa

    if-ne v0, v6, :cond_9d

    .line 122
    invoke-static {v3}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v0

    goto :goto_3a

    .line 124
    :cond_9d
    const/4 v0, 0x1

    invoke-static {v0}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v0

    goto :goto_3a

    .line 126
    :cond_a3
    invoke-virtual {v4, v1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    .line 111
    add-int/lit8 v0, v2, 0x1

    move v2, v0

    goto :goto_32

    .line 128
    :cond_aa
    invoke-virtual {v4}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getPasswordList(Lcom/iflytek/cloud/SpeechListener;)V
    .registers 4

    .prologue
    .line 89
    new-instance v0, Lcom/iflytek/cloud/DataDownloader;

    iget-object v1, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mContext:Landroid/content/Context;

    invoke-direct {v0, v1}, Lcom/iflytek/cloud/DataDownloader;-><init>(Landroid/content/Context;)V

    .line 90
    iget-object v1, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mSessionParams:Lcom/iflytek/thirdparty/ad;

    invoke-virtual {v0, v1}, Lcom/iflytek/cloud/DataDownloader;->setParameter(Lcom/iflytek/thirdparty/ad;)Z

    .line 91
    invoke-virtual {v0, p1}, Lcom/iflytek/cloud/DataDownloader;->downloadData(Lcom/iflytek/cloud/SpeechListener;)I

    .line 92
    return-void
.end method

.method public isListening()Z
    .registers 2

    .prologue
    .line 265
    invoke-virtual {p0}, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->isRunning()Z

    move-result v0

    return v0
.end method

.method public sendRequest(Ljava/lang/String;Ljava/lang/String;Lcom/iflytek/cloud/SpeechListener;)I
    .registers 9

    .prologue
    .line 269
    const/4 v0, 0x0

    .line 271
    iget-object v2, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mSynObj:Ljava/lang/Object;

    monitor-enter v2

    .line 273
    :try_start_4
    iget-object v1, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mSessionParams:Lcom/iflytek/thirdparty/ad;

    const-string v3, "cmd"

    invoke-virtual {v1, v3, p1}, Lcom/iflytek/thirdparty/ad;->a(Ljava/lang/String;Ljava/lang/String;)V

    .line 274
    iget-object v1, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mSessionParams:Lcom/iflytek/thirdparty/ad;

    const-string v3, "auth_id"

    invoke-virtual {v1, v3, p2}, Lcom/iflytek/thirdparty/ad;->a(Ljava/lang/String;Ljava/lang/String;)V

    .line 276
    new-instance v1, Lcom/iflytek/thirdparty/f;

    iget-object v3, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mContext:Landroid/content/Context;

    const-string v4, "manager"

    invoke-virtual {p0, v4}, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->getHandlerThread(Ljava/lang/String;)Landroid/os/HandlerThread;

    move-result-object v4

    invoke-direct {v1, v3, v4}, Lcom/iflytek/thirdparty/f;-><init>(Landroid/content/Context;Landroid/os/HandlerThread;)V

    .line 277
    iget-object v3, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mSessionParams:Lcom/iflytek/thirdparty/ad;

    new-instance v4, Lcom/iflytek/thirdparty/f$a;

    invoke-direct {v4, p3}, Lcom/iflytek/thirdparty/f$a;-><init>(Lcom/iflytek/cloud/SpeechListener;)V

    invoke-virtual {v1, v3, v4}, Lcom/iflytek/thirdparty/f;->a(Lcom/iflytek/thirdparty/ad;Lcom/iflytek/thirdparty/f$a;)V
    :try_end_29
    .catch Lcom/iflytek/cloud/SpeechError; {:try_start_4 .. :try_end_29} :catch_2b
    .catch Ljava/lang/Throwable; {:try_start_4 .. :try_end_29} :catch_35
    .catchall {:try_start_4 .. :try_end_29} :catchall_3d

    .line 285
    :goto_29
    :try_start_29
    monitor-exit v2

    .line 287
    return v0

    .line 278
    :catch_2b
    move-exception v0

    .line 279
    invoke-virtual {v0}, Lcom/iflytek/cloud/SpeechError;->getErrorCode()I

    move-result v1

    .line 280
    invoke-static {v0}, Lcom/iflytek/cloud/msc/util/log/DebugLog;->LogE(Ljava/lang/Throwable;)V

    move v0, v1

    .line 284
    goto :goto_29

    .line 281
    :catch_35
    move-exception v0

    .line 282
    const/16 v1, 0x5207

    .line 283
    invoke-static {v0}, Lcom/iflytek/cloud/msc/util/log/DebugLog;->LogE(Ljava/lang/Throwable;)V

    move v0, v1

    goto :goto_29

    .line 285
    :catchall_3d
    move-exception v0

    monitor-exit v2
    :try_end_3f
    .catchall {:try_start_29 .. :try_end_3f} :catchall_3d

    throw v0
.end method

.method public startListening(Lcom/iflytek/cloud/VerifierListener;)I
    .registers 8

    .prologue
    const/4 v1, 0x0

    .line 45
    .line 47
    iget-object v2, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mSynObj:Ljava/lang/Object;

    monitor-enter v2

    .line 49
    :try_start_4
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mSessionParams:Lcom/iflytek/thirdparty/ad;

    const-string v3, "request_audio_focus"

    const/4 v4, 0x1

    invoke-virtual {v0, v3, v4}, Lcom/iflytek/thirdparty/ad;->a(Ljava/lang/String;Z)Z

    move-result v0

    iput-boolean v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mRequestFocus:Z

    .line 51
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mscer:Lcom/iflytek/thirdparty/s;

    if-eqz v0, :cond_29

    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mscer:Lcom/iflytek/thirdparty/s;

    invoke-virtual {v0}, Lcom/iflytek/thirdparty/s;->isRunning()Z

    move-result v0

    if-eqz v0, :cond_29

    .line 54
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mscer:Lcom/iflytek/thirdparty/s;

    iget-object v3, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mSessionParams:Lcom/iflytek/thirdparty/ad;

    const-string v4, "isv_interrupt_error"

    const/4 v5, 0x0

    invoke-virtual {v3, v4, v5}, Lcom/iflytek/thirdparty/ad;->a(Ljava/lang/String;Z)Z

    move-result v3

    invoke-virtual {v0, v3}, Lcom/iflytek/thirdparty/s;->cancel(Z)V

    .line 57
    :cond_29
    new-instance v0, Lcom/iflytek/thirdparty/g;

    iget-object v3, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mContext:Landroid/content/Context;

    iget-object v4, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mSessionParams:Lcom/iflytek/thirdparty/ad;

    const-string v5, "verify"

    invoke-virtual {p0, v5}, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->getHandlerThread(Ljava/lang/String;)Landroid/os/HandlerThread;

    move-result-object v5

    invoke-direct {v0, v3, v4, v5}, Lcom/iflytek/thirdparty/g;-><init>(Landroid/content/Context;Lcom/iflytek/thirdparty/ad;Landroid/os/HandlerThread;)V

    iput-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mscer:Lcom/iflytek/thirdparty/s;

    .line 59
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mContext:Landroid/content/Context;

    iget-boolean v3, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mRequestFocus:Z

    invoke-static {v3}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v3

    const/4 v4, 0x0

    invoke-static {v0, v3, v4}, Lcom/iflytek/cloud/msc/util/FuncAdapter;->Lock(Landroid/content/Context;Ljava/lang/Boolean;Landroid/media/AudioManager$OnAudioFocusChangeListener;)Z

    .line 60
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mscer:Lcom/iflytek/thirdparty/s;

    check-cast v0, Lcom/iflytek/thirdparty/g;

    new-instance v3, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl$InternalListener;

    invoke-direct {v3, p0, p1}, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl$InternalListener;-><init>(Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;Lcom/iflytek/cloud/VerifierListener;)V

    invoke-virtual {v0, v3}, Lcom/iflytek/thirdparty/g;->a(Lcom/iflytek/cloud/VerifierListener;)V
    :try_end_52
    .catch Lcom/iflytek/cloud/SpeechError; {:try_start_4 .. :try_end_52} :catch_55
    .catch Ljava/lang/Throwable; {:try_start_4 .. :try_end_52} :catch_5f
    .catchall {:try_start_4 .. :try_end_52} :catchall_67

    move v0, v1

    .line 68
    :goto_53
    :try_start_53
    monitor-exit v2

    .line 70
    return v0

    .line 61
    :catch_55
    move-exception v0

    .line 62
    invoke-virtual {v0}, Lcom/iflytek/cloud/SpeechError;->getErrorCode()I

    move-result v1

    .line 63
    invoke-static {v0}, Lcom/iflytek/cloud/msc/util/log/DebugLog;->LogE(Ljava/lang/Throwable;)V

    move v0, v1

    .line 67
    goto :goto_53

    .line 64
    :catch_5f
    move-exception v0

    .line 65
    const/16 v1, 0x5207

    .line 66
    invoke-static {v0}, Lcom/iflytek/cloud/msc/util/log/DebugLog;->LogE(Ljava/lang/Throwable;)V

    move v0, v1

    goto :goto_53

    .line 68
    :catchall_67
    move-exception v0

    monitor-exit v2
    :try_end_69
    .catchall {:try_start_53 .. :try_end_69} :catchall_67

    throw v0
.end method

.method public stopListening()V
    .registers 3

    .prologue
    .line 77
    iget-object v1, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mSynObj:Ljava/lang/Object;

    monitor-enter v1

    .line 78
    :try_start_3
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mscer:Lcom/iflytek/thirdparty/s;

    if-eqz v0, :cond_e

    .line 79
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mscer:Lcom/iflytek/thirdparty/s;

    check-cast v0, Lcom/iflytek/thirdparty/g;

    invoke-virtual {v0}, Lcom/iflytek/thirdparty/g;->a()Z

    .line 81
    :cond_e
    monitor-exit v1

    .line 82
    return-void

    .line 81
    :catchall_10
    move-exception v0

    monitor-exit v1
    :try_end_12
    .catchall {:try_start_3 .. :try_end_12} :catchall_10

    throw v0
.end method

.method public writeAudio([BII)I
    .registers 8

    .prologue
    const/16 v0, 0x277d

    .line 241
    iget-object v1, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mSynObj:Ljava/lang/Object;

    monitor-enter v1

    .line 242
    :try_start_5
    iget-object v2, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mscer:Lcom/iflytek/thirdparty/s;

    if-nez v2, :cond_12

    .line 243
    const-string v0, "writeAudio error, no active session."

    invoke-static {v0}, Lcom/iflytek/cloud/msc/util/log/DebugLog;->LogD(Ljava/lang/String;)V

    .line 244
    const/16 v0, 0x520c

    monitor-exit v1

    .line 260
    :goto_11
    return v0

    .line 247
    :cond_12
    if-eqz p1, :cond_17

    array-length v2, p1

    if-gtz v2, :cond_21

    .line 248
    :cond_17
    const-string v2, "writeAudio error,buffer is null."

    invoke-static {v2}, Lcom/iflytek/cloud/msc/util/log/DebugLog;->LogD(Ljava/lang/String;)V

    .line 249
    monitor-exit v1

    goto :goto_11

    .line 261
    :catchall_1e
    move-exception v0

    monitor-exit v1
    :try_end_20
    .catchall {:try_start_5 .. :try_end_20} :catchall_1e

    throw v0

    .line 252
    :cond_21
    :try_start_21
    array-length v2, p1

    add-int v3, p3, p2

    if-ge v2, v3, :cond_2d

    .line 253
    const-string v2, "writeAudio error,buffer length < length."

    invoke-static {v2}, Lcom/iflytek/cloud/msc/util/log/DebugLog;->LogD(Ljava/lang/String;)V

    .line 254
    monitor-exit v1

    goto :goto_11

    .line 256
    :cond_2d
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mscer:Lcom/iflytek/thirdparty/s;

    check-cast v0, Lcom/iflytek/thirdparty/g;

    invoke-virtual {v0}, Lcom/iflytek/thirdparty/g;->f()I

    move-result v0

    const/4 v2, -0x1

    if-eq v0, v2, :cond_3c

    .line 257
    const/16 v0, 0x277a

    monitor-exit v1

    goto :goto_11

    .line 259
    :cond_3c
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeakerVerifierImpl;->mscer:Lcom/iflytek/thirdparty/s;

    check-cast v0, Lcom/iflytek/thirdparty/g;

    invoke-virtual {v0, p1, p2, p3}, Lcom/iflytek/thirdparty/g;->onRecordBuffer([BII)V

    .line 260
    const/4 v0, 0x0

    monitor-exit v1
    :try_end_45
    .catchall {:try_start_21 .. :try_end_45} :catchall_1e

    goto :goto_11
.end method