今奥全景相机
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1938 lines
46 KiB

.class Lcom/a/k;
.super Ljava/lang/Object;
# interfaces
.implements Lcom/a/c$e;
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/a/k$c;,
Lcom/a/k$b;,
Lcom/a/k$a;
}
.end annotation
# static fields
.field static a:Lcom/a/k;
# instance fields
.field private b:Landroid/hardware/usb/UsbManager;
.field private c:Landroid/content/Context;
.field private d:Landroid/os/Handler;
.field private e:Lcom/a/c$c;
.field private f:Lcom/a/c$d;
.field private g:Lcom/a/c$d;
.field private h:Landroid/hardware/usb/UsbDevice;
.field private i:Ljava/lang/String;
.field private j:Landroid/hardware/usb/UsbInterface;
.field private k:Landroid/hardware/usb/UsbInterface;
.field private l:Landroid/hardware/usb/UsbEndpoint;
.field private m:Landroid/hardware/usb/UsbDeviceConnection;
.field private n:Landroid/hardware/usb/UsbEndpoint;
.field private o:Landroid/hardware/usb/UsbEndpoint;
.field private p:Z
.field private q:Landroid/content/BroadcastReceiver;
.field private r:I
.field private s:J
.field private t:J
.field private u:J
# direct methods
.method constructor <init>()V
.locals 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
new-instance v0, Lcom/a/k$2;
invoke-direct {v0, p0}, Lcom/a/k$2;-><init>(Lcom/a/k;)V
iput-object v0, p0, Lcom/a/k;->q:Landroid/content/BroadcastReceiver;
const/4 v0, -0x1
iput v0, p0, Lcom/a/k;->r:I
return-void
.end method
.method static synthetic a(Lcom/a/k;J)J
.locals 1
iput-wide p1, p0, Lcom/a/k;->s:J
return-wide p1
.end method
.method public static a()Lcom/a/k;
.locals 1
sget-object v0, Lcom/a/k;->a:Lcom/a/k;
if-nez v0, :cond_0
new-instance v0, Lcom/a/k;
invoke-direct {v0}, Lcom/a/k;-><init>()V
sput-object v0, Lcom/a/k;->a:Lcom/a/k;
:cond_0
sget-object v0, Lcom/a/k;->a:Lcom/a/k;
return-object v0
.end method
.method static synthetic a(Lcom/a/k;Ljava/lang/String;)Ljava/lang/String;
.locals 0
iput-object p1, p0, Lcom/a/k;->i:Ljava/lang/String;
return-object p1
.end method
.method static synthetic a(Lcom/a/k;)V
.locals 0
invoke-direct {p0}, Lcom/a/k;->c()V
return-void
.end method
.method static synthetic a(Lcom/a/k;[BI)V
.locals 0
invoke-direct {p0, p1, p2}, Lcom/a/k;->b([BI)V
return-void
.end method
.method static synthetic a(Lcom/a/k;Z)Z
.locals 0
iput-boolean p1, p0, Lcom/a/k;->p:Z
return p1
.end method
.method static synthetic b(Lcom/a/k;J)J
.locals 1
iput-wide p1, p0, Lcom/a/k;->t:J
return-wide p1
.end method
.method static synthetic b(Lcom/a/k;)Landroid/os/Handler;
.locals 1
iget-object v0, p0, Lcom/a/k;->d:Landroid/os/Handler;
return-object v0
.end method
.method static synthetic b(Lcom/a/k;[BI)V
.locals 0
invoke-direct {p0, p1, p2}, Lcom/a/k;->c([BI)V
return-void
.end method
.method private b([BI)V
.locals 5
invoke-static {}, Lcom/a/n;->a()Lcom/a/n;
move-result-object v2
:try_start_0
invoke-virtual {v2, p1, p2}, Lcom/a/n;->a([BI)V
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
.catch Ljava/lang/OutOfMemoryError; {:try_start_0 .. :try_end_0} :catch_1
:goto_0
invoke-virtual {v2}, Lcom/a/n;->b()Z
move-result v0
if-eqz v0, :cond_1
iget-object v0, v2, Lcom/a/n;->a:Ljava/util/ArrayList;
invoke-virtual {v0}, Ljava/util/ArrayList;->size()I
move-result v0
add-int/lit8 v0, v0, -0x1
move v1, v0
:goto_1
if-ltz v1, :cond_1
iget-object v0, v2, Lcom/a/n;->a:Ljava/util/ArrayList;
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/a/o;
iget-boolean v3, v0, Lcom/a/o;->a:Z
if-eqz v3, :cond_0
iget-object v3, p0, Lcom/a/k;->g:Lcom/a/c$d;
invoke-interface {v3, v0}, Lcom/a/c$d;->a(Lcom/a/o;)V
iget-object v0, v2, Lcom/a/n;->a:Ljava/util/ArrayList;
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->remove(I)Ljava/lang/Object;
:cond_0
add-int/lit8 v0, v1, -0x1
move v1, v0
goto :goto_1
:catch_0
move-exception v0
const-string v1, "UsbHostTransfer"
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "parseCmd:"
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v0}, Ljava/lang/Exception;->toString()Ljava/lang/String;
move-result-object v0
invoke-virtual {v3, v0}, 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 {v1, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
goto :goto_0
:catch_1
move-exception v0
const-string v1, "UsbHostTransfer"
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "parseCmd:"
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v0}, Ljava/lang/OutOfMemoryError;->toString()Ljava/lang/String;
move-result-object v0
invoke-virtual {v3, v0}, 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 {v1, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
goto :goto_0
:cond_1
return-void
.end method
.method private b(Landroid/hardware/usb/UsbDevice;)Z
.locals 6
const/4 v5, 0x2
const/4 v4, -0x1
const/4 v0, 0x0
iget v1, p0, Lcom/a/k;->r:I
if-eq v1, v4, :cond_1
:cond_0
:goto_0
return v0
:cond_1
iget-object v1, p0, Lcom/a/k;->e:Lcom/a/c$c;
invoke-interface {v1, p1}, Lcom/a/c$c;->checkDeviceMode(Landroid/hardware/usb/UsbDevice;)I
move-result v1
iput v1, p0, Lcom/a/k;->r:I
const-string v1, "UsbHostTransfer"
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "modeType:"
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
iget v3, p0, Lcom/a/k;->r:I
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-static {v1, v2}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
iget v1, p0, Lcom/a/k;->r:I
if-eq v1, v4, :cond_0
iget v1, p0, Lcom/a/k;->r:I
if-nez v1, :cond_4
iget-object v1, p0, Lcom/a/k;->b:Landroid/hardware/usb/UsbManager;
invoke-virtual {v1, p1}, Landroid/hardware/usb/UsbManager;->openDevice(Landroid/hardware/usb/UsbDevice;)Landroid/hardware/usb/UsbDeviceConnection;
move-result-object v1
if-nez v1, :cond_2
const-string v1, "UsbHostTransfer"
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "can\'t openDevice:"
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-static {v1, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
goto :goto_0
:cond_2
iget-object v2, p0, Lcom/a/k;->e:Lcom/a/c$c;
invoke-interface {v2}, Lcom/a/c$c;->getAccessoryInfomation()Lcom/a/c$a;
move-result-object v2
invoke-static {v1, v2}, Lcom/a/i;->a(Landroid/hardware/usb/UsbDeviceConnection;Lcom/a/c$a;)Z
move-result v2
if-nez v2, :cond_3
const-string v2, "UsbHostTransfer"
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "can\'t set accessory mode"
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-static {v2, v3}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
:cond_3
invoke-virtual {v1}, Landroid/hardware/usb/UsbDeviceConnection;->close()V
goto :goto_0
:cond_4
iget v1, p0, Lcom/a/k;->r:I
if-ne v1, v5, :cond_5
iget-object v1, p0, Lcom/a/k;->b:Landroid/hardware/usb/UsbManager;
invoke-virtual {v1, p1}, Landroid/hardware/usb/UsbManager;->openDevice(Landroid/hardware/usb/UsbDevice;)Landroid/hardware/usb/UsbDeviceConnection;
move-result-object v1
if-eqz v1, :cond_0
invoke-static {v1}, Lcom/a/i;->a(Landroid/hardware/usb/UsbDeviceConnection;)Z
move-result v1
if-nez v1, :cond_0
const-string v1, "UsbHostTransfer"
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "can\'t set bulk mode"
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-static {v1, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
goto/16 :goto_0
:cond_5
iget v1, p0, Lcom/a/k;->r:I
const/4 v2, 0x1
if-eq v1, v2, :cond_6
iget v1, p0, Lcom/a/k;->r:I
const/4 v2, 0x3
if-ne v1, v2, :cond_7
:cond_6
iget v1, p0, Lcom/a/k;->r:I
invoke-direct {p0}, Lcom/a/k;->d()V
iput v1, p0, Lcom/a/k;->r:I
:cond_7
:try_start_0
invoke-direct {p0, p1}, Lcom/a/k;->c(Landroid/hardware/usb/UsbDevice;)Z
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
move-result v0
goto/16 :goto_0
:catch_0
move-exception v1
const-string v2, "UsbHostTransfer"
const-string v3, "openUsbDevice"
invoke-static {v2, v3, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
iget-object v1, p0, Lcom/a/k;->e:Lcom/a/c$c;
const-string v2, ""
invoke-interface {v1, v2, v5}, Lcom/a/c$c;->onUSBDeviceStatus(Ljava/lang/String;I)V
const-string v1, "UsbHostTransfer"
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "open usb device fail:"
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-static {v1, v2}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
invoke-direct {p0}, Lcom/a/k;->d()V
goto/16 :goto_0
.end method
.method static synthetic c(Lcom/a/k;J)J
.locals 1
iput-wide p1, p0, Lcom/a/k;->u:J
return-wide p1
.end method
.method static synthetic c(Lcom/a/k;)Lcom/a/c$c;
.locals 1
iget-object v0, p0, Lcom/a/k;->e:Lcom/a/c$c;
return-object v0
.end method
.method private c()V
.locals 2
iget-object v0, p0, Lcom/a/k;->b:Landroid/hardware/usb/UsbManager;
invoke-virtual {v0}, Landroid/hardware/usb/UsbManager;->getDeviceList()Ljava/util/HashMap;
move-result-object v0
if-nez v0, :cond_1
const-string v0, "UsbHostTransfer"
const-string v1, "No Device List Found"
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
:cond_0
:goto_0
return-void
:cond_1
invoke-virtual {v0}, Ljava/util/HashMap;->values()Ljava/util/Collection;
move-result-object v0
invoke-interface {v0}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;
move-result-object v1
:cond_2
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
move-result v0
if-eqz v0, :cond_0
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/hardware/usb/UsbDevice;
invoke-virtual {p0, v0}, Lcom/a/k;->a(Landroid/hardware/usb/UsbDevice;)Z
move-result v0
if-eqz v0, :cond_2
goto :goto_0
.end method
.method private c([BI)V
.locals 5
invoke-static {}, Lcom/a/p;->a()Lcom/a/p;
move-result-object v2
:try_start_0
invoke-virtual {v2, p1, p2}, Lcom/a/p;->a([BI)V
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
.catch Ljava/lang/OutOfMemoryError; {:try_start_0 .. :try_end_0} :catch_1
:goto_0
invoke-virtual {v2}, Lcom/a/p;->b()Z
move-result v0
if-eqz v0, :cond_1
iget-object v0, v2, Lcom/a/p;->a:Ljava/util/ArrayList;
invoke-virtual {v0}, Ljava/util/ArrayList;->size()I
move-result v0
add-int/lit8 v0, v0, -0x1
move v1, v0
:goto_1
if-ltz v1, :cond_1
iget-object v0, v2, Lcom/a/p;->a:Ljava/util/ArrayList;
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/a/o;
iget-boolean v3, v0, Lcom/a/o;->a:Z
if-eqz v3, :cond_0
iget-object v3, p0, Lcom/a/k;->g:Lcom/a/c$d;
invoke-interface {v3, v0}, Lcom/a/c$d;->a(Lcom/a/o;)V
iget-object v0, v2, Lcom/a/p;->a:Ljava/util/ArrayList;
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->remove(I)Ljava/lang/Object;
:cond_0
add-int/lit8 v0, v1, -0x1
move v1, v0
goto :goto_1
:catch_0
move-exception v0
const-string v1, "UsbHostTransfer"
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "parseStream:"
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v0}, Ljava/lang/Exception;->toString()Ljava/lang/String;
move-result-object v0
invoke-virtual {v3, v0}, 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 {v1, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
goto :goto_0
:catch_1
move-exception v0
const-string v1, "UsbHostTransfer"
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "parseStream:"
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v0}, Ljava/lang/OutOfMemoryError;->toString()Ljava/lang/String;
move-result-object v0
invoke-virtual {v3, v0}, 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 {v1, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
invoke-virtual {v2}, Lcom/a/p;->c()V
goto :goto_0
:cond_1
return-void
.end method
.method private c(Landroid/hardware/usb/UsbDevice;)Z
.locals 9
const/16 v8, 0x80
const/4 v7, 0x3
const/4 v1, 0x1
const/4 v0, 0x0
invoke-virtual {p1}, Landroid/hardware/usb/UsbDevice;->getInterfaceCount()I
move-result v2
const-string v3, "UsbHostTransfer"
new-instance v4, Ljava/lang/StringBuilder;
invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V
const-string v5, "interfaceCount = "
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v4
invoke-static {v3, v4}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
if-gtz v2, :cond_0
:goto_0
return v0
:cond_0
monitor-enter p0
:try_start_0
iget-object v2, p0, Lcom/a/k;->b:Landroid/hardware/usb/UsbManager;
invoke-virtual {v2, p1}, Landroid/hardware/usb/UsbManager;->openDevice(Landroid/hardware/usb/UsbDevice;)Landroid/hardware/usb/UsbDeviceConnection;
move-result-object v2
iput-object v2, p0, Lcom/a/k;->m:Landroid/hardware/usb/UsbDeviceConnection;
const/4 v2, 0x0
invoke-virtual {p1, v2}, Landroid/hardware/usb/UsbDevice;->getInterface(I)Landroid/hardware/usb/UsbInterface;
move-result-object v2
iput-object v2, p0, Lcom/a/k;->j:Landroid/hardware/usb/UsbInterface;
iget v2, p0, Lcom/a/k;->r:I
if-ne v2, v7, :cond_4
const/4 v2, 0x1
invoke-virtual {p1, v2}, Landroid/hardware/usb/UsbDevice;->getInterface(I)Landroid/hardware/usb/UsbInterface;
move-result-object v2
iput-object v2, p0, Lcom/a/k;->k:Landroid/hardware/usb/UsbInterface;
iget-object v2, p0, Lcom/a/k;->m:Landroid/hardware/usb/UsbDeviceConnection;
iget-object v3, p0, Lcom/a/k;->k:Landroid/hardware/usb/UsbInterface;
const/4 v4, 0x1
invoke-virtual {v2, v3, v4}, Landroid/hardware/usb/UsbDeviceConnection;->claimInterface(Landroid/hardware/usb/UsbInterface;Z)Z
move-result v2
if-nez v2, :cond_1
const-string v1, "UsbHostTransfer"
const-string v2, "claimInterfaceForTransferH264 error, we will continue to run...."
invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
iget-object v1, p0, Lcom/a/k;->e:Lcom/a/c$c;
const-string v2, ""
const/4 v3, 0x2
invoke-interface {v1, v2, v3}, Lcom/a/c$c;->onUSBDeviceStatus(Ljava/lang/String;I)V
invoke-direct {p0}, Lcom/a/k;->d()V
monitor-exit p0
goto :goto_0
:catchall_0
move-exception v0
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw v0
:cond_1
:try_start_1
const-string v2, "UsbHostTransfer"
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "Inertface 1 has endpoint count = "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
iget-object v4, p0, Lcom/a/k;->k:Landroid/hardware/usb/UsbInterface;
invoke-virtual {v4}, Landroid/hardware/usb/UsbInterface;->getEndpointCount()I
move-result v4
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-static {v2, v3}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
move v2, v0
:goto_1
iget-object v3, p0, Lcom/a/k;->k:Landroid/hardware/usb/UsbInterface;
invoke-virtual {v3}, Landroid/hardware/usb/UsbInterface;->getEndpointCount()I
move-result v3
if-ge v2, v3, :cond_3
iget-object v3, p0, Lcom/a/k;->k:Landroid/hardware/usb/UsbInterface;
invoke-virtual {v3, v2}, Landroid/hardware/usb/UsbInterface;->getEndpoint(I)Landroid/hardware/usb/UsbEndpoint;
move-result-object v3
invoke-virtual {v3}, Landroid/hardware/usb/UsbEndpoint;->getDirection()I
move-result v4
if-ne v4, v8, :cond_2
iput-object v3, p0, Lcom/a/k;->l:Landroid/hardware/usb/UsbEndpoint;
const-string v3, "UsbHostTransfer"
new-instance v4, Ljava/lang/StringBuilder;
invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V
const-string v5, "endpoint2 "
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v4
const-string v5, " is IN endpoint"
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v4
invoke-static {v3, v4}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
:cond_2
add-int/lit8 v2, v2, 0x1
goto :goto_1
:cond_3
iget-object v2, p0, Lcom/a/k;->l:Landroid/hardware/usb/UsbEndpoint;
if-nez v2, :cond_4
const-string v1, "UsbHostTransfer"
const-string v2, "endpoinsForTransferH264 the in direction is not found"
invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
iget-object v1, p0, Lcom/a/k;->e:Lcom/a/c$c;
const-string v2, ""
const/4 v3, 0x2
invoke-interface {v1, v2, v3}, Lcom/a/c$c;->onUSBDeviceStatus(Ljava/lang/String;I)V
invoke-direct {p0}, Lcom/a/k;->d()V
monitor-exit p0
goto/16 :goto_0
:cond_4
iget-object v2, p0, Lcom/a/k;->m:Landroid/hardware/usb/UsbDeviceConnection;
iget-object v3, p0, Lcom/a/k;->j:Landroid/hardware/usb/UsbInterface;
const/4 v4, 0x1
invoke-virtual {v2, v3, v4}, Landroid/hardware/usb/UsbDeviceConnection;->claimInterface(Landroid/hardware/usb/UsbInterface;Z)Z
move-result v2
if-nez v2, :cond_5
const-string v1, "UsbHostTransfer"
const-string v2, "claimInterface error, we will continue to run...."
invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
iget-object v1, p0, Lcom/a/k;->e:Lcom/a/c$c;
const-string v2, ""
const/4 v3, 0x2
invoke-interface {v1, v2, v3}, Lcom/a/c$c;->onUSBDeviceStatus(Ljava/lang/String;I)V
invoke-direct {p0}, Lcom/a/k;->d()V
monitor-exit p0
goto/16 :goto_0
:cond_5
const-string v2, "UsbHostTransfer"
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "Inertface 0 has endpoint count = "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
iget-object v4, p0, Lcom/a/k;->j:Landroid/hardware/usb/UsbInterface;
invoke-virtual {v4}, Landroid/hardware/usb/UsbInterface;->getEndpointCount()I
move-result v4
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-static {v2, v3}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
move v2, v0
:goto_2
iget-object v3, p0, Lcom/a/k;->j:Landroid/hardware/usb/UsbInterface;
invoke-virtual {v3}, Landroid/hardware/usb/UsbInterface;->getEndpointCount()I
move-result v3
if-ge v2, v3, :cond_8
iget-object v3, p0, Lcom/a/k;->j:Landroid/hardware/usb/UsbInterface;
invoke-virtual {v3, v2}, Landroid/hardware/usb/UsbInterface;->getEndpoint(I)Landroid/hardware/usb/UsbEndpoint;
move-result-object v3
invoke-virtual {v3}, Landroid/hardware/usb/UsbEndpoint;->getDirection()I
move-result v4
if-ne v4, v8, :cond_6
iput-object v3, p0, Lcom/a/k;->n:Landroid/hardware/usb/UsbEndpoint;
const-string v4, "UsbHostTransfer"
new-instance v5, Ljava/lang/StringBuilder;
invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V
const-string v6, "endpoint "
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
invoke-virtual {v5, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v5
const-string v6, " is IN endpoint"
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v5
invoke-static {v4, v5}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
:cond_6
invoke-virtual {v3}, Landroid/hardware/usb/UsbEndpoint;->getDirection()I
move-result v4
if-nez v4, :cond_7
iput-object v3, p0, Lcom/a/k;->o:Landroid/hardware/usb/UsbEndpoint;
const-string v3, "UsbHostTransfer"
new-instance v4, Ljava/lang/StringBuilder;
invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V
const-string v5, "endpoint "
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v4
const-string v5, " is OUT endpoint"
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v4
invoke-static {v3, v4}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
:cond_7
add-int/lit8 v2, v2, 0x1
goto :goto_2
:cond_8
iget-object v2, p0, Lcom/a/k;->n:Landroid/hardware/usb/UsbEndpoint;
if-eqz v2, :cond_9
iget-object v2, p0, Lcom/a/k;->o:Landroid/hardware/usb/UsbEndpoint;
if-nez v2, :cond_a
:cond_9
const-string v1, "UsbHostTransfer"
const-string v2, "endpoins in both direction not found"
invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
iget-object v1, p0, Lcom/a/k;->e:Lcom/a/c$c;
const-string v2, ""
const/4 v3, 0x2
invoke-interface {v1, v2, v3}, Lcom/a/c$c;->onUSBDeviceStatus(Ljava/lang/String;I)V
invoke-direct {p0}, Lcom/a/k;->d()V
monitor-exit p0
goto/16 :goto_0
:cond_a
iput-object p1, p0, Lcom/a/k;->h:Landroid/hardware/usb/UsbDevice;
const/4 v0, 0x0
iput-object v0, p0, Lcom/a/k;->i:Ljava/lang/String;
const/4 v0, 0x1
iput-boolean v0, p0, Lcom/a/k;->p:Z
new-instance v0, Ljava/lang/Thread;
new-instance v2, Lcom/a/k$b;
invoke-direct {v2, p0}, Lcom/a/k$b;-><init>(Lcom/a/k;)V
const-string v3, "UsbReadLoop"
invoke-direct {v0, v2, v3}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;Ljava/lang/String;)V
invoke-virtual {v0}, Ljava/lang/Thread;->start()V
iget v0, p0, Lcom/a/k;->r:I
if-ne v0, v7, :cond_b
iget-object v0, p0, Lcom/a/k;->e:Lcom/a/c$c;
const/4 v2, 0x0
const/16 v3, 0x65
invoke-interface {v0, v2, v3}, Lcom/a/c$c;->onUSBDeviceStatus(Ljava/lang/String;I)V
new-instance v0, Ljava/lang/Thread;
new-instance v2, Lcom/a/k$c;
invoke-direct {v2, p0}, Lcom/a/k$c;-><init>(Lcom/a/k;)V
const-string v3, "UsbStreamLoop"
invoke-direct {v0, v2, v3}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;Ljava/lang/String;)V
invoke-virtual {v0}, Ljava/lang/Thread;->start()V
:cond_b
const-string v0, "UsbHostTransfer"
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "open usb device ok:"
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-static {v0, v2}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
move v0, v1
goto/16 :goto_0
.end method
.method static synthetic d(Lcom/a/k;)Landroid/hardware/usb/UsbDevice;
.locals 1
iget-object v0, p0, Lcom/a/k;->h:Landroid/hardware/usb/UsbDevice;
return-object v0
.end method
.method private d()V
.locals 3
monitor-enter p0
:try_start_0
const-string v0, "UsbHostTransfer"
const-string v1, "closeUsbDevice()"
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
iget-object v0, p0, Lcom/a/k;->h:Landroid/hardware/usb/UsbDevice;
if-eqz v0, :cond_0
const-string v0, "UsbHostTransfer"
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "device "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
iget-object v2, p0, Lcom/a/k;->i:Ljava/lang/String;
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, " closed"
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-static {v0, v1}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
const/4 v0, 0x0
iput-object v0, p0, Lcom/a/k;->h:Landroid/hardware/usb/UsbDevice;
:cond_0
iget-object v0, p0, Lcom/a/k;->i:Ljava/lang/String;
if-eqz v0, :cond_1
iget-object v0, p0, Lcom/a/k;->e:Lcom/a/c$c;
iget-object v1, p0, Lcom/a/k;->i:Ljava/lang/String;
const/4 v2, 0x0
invoke-interface {v0, v1, v2}, Lcom/a/c$c;->onUSBDeviceStatus(Ljava/lang/String;I)V
const/4 v0, 0x0
iput-object v0, p0, Lcom/a/k;->i:Ljava/lang/String;
:cond_1
iget v0, p0, Lcom/a/k;->r:I
const/4 v1, 0x3
if-ne v0, v1, :cond_2
iget-object v0, p0, Lcom/a/k;->e:Lcom/a/c$c;
const/4 v1, 0x0
const/4 v2, 0x0
invoke-interface {v0, v1, v2}, Lcom/a/c$c;->onUSBDeviceStatus(Ljava/lang/String;I)V
const/4 v0, -0x1
iput v0, p0, Lcom/a/k;->r:I
:cond_2
iget-object v0, p0, Lcom/a/k;->m:Landroid/hardware/usb/UsbDeviceConnection;
const/4 v1, 0x0
iput-object v1, p0, Lcom/a/k;->m:Landroid/hardware/usb/UsbDeviceConnection;
iget-object v1, p0, Lcom/a/k;->j:Landroid/hardware/usb/UsbInterface;
if-eqz v1, :cond_4
if-eqz v0, :cond_3
iget-object v1, p0, Lcom/a/k;->j:Landroid/hardware/usb/UsbInterface;
invoke-virtual {v0, v1}, Landroid/hardware/usb/UsbDeviceConnection;->releaseInterface(Landroid/hardware/usb/UsbInterface;)Z
:cond_3
const/4 v1, 0x0
iput-object v1, p0, Lcom/a/k;->j:Landroid/hardware/usb/UsbInterface;
:cond_4
if-eqz v0, :cond_5
invoke-virtual {v0}, Landroid/hardware/usb/UsbDeviceConnection;->close()V
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
.catchall {:try_start_0 .. :try_end_0} :catchall_1
:cond_5
const/4 v0, 0x0
:try_start_1
iput-object v0, p0, Lcom/a/k;->j:Landroid/hardware/usb/UsbInterface;
const/4 v0, 0x0
iput-object v0, p0, Lcom/a/k;->m:Landroid/hardware/usb/UsbDeviceConnection;
const/4 v0, 0x0
iput-object v0, p0, Lcom/a/k;->n:Landroid/hardware/usb/UsbEndpoint;
const/4 v0, 0x0
iput-object v0, p0, Lcom/a/k;->l:Landroid/hardware/usb/UsbEndpoint;
const/4 v0, 0x0
iput-object v0, p0, Lcom/a/k;->o:Landroid/hardware/usb/UsbEndpoint;
const/4 v0, 0x0
iput-object v0, p0, Lcom/a/k;->h:Landroid/hardware/usb/UsbDevice;
const/4 v0, 0x0
iput-boolean v0, p0, Lcom/a/k;->p:Z
const/4 v0, 0x0
iput-object v0, p0, Lcom/a/k;->i:Ljava/lang/String;
iget-object v0, p0, Lcom/a/k;->f:Lcom/a/c$d;
invoke-interface {v0}, Lcom/a/c$d;->b()V
iget-object v0, p0, Lcom/a/k;->g:Lcom/a/c$d;
invoke-interface {v0}, Lcom/a/c$d;->b()V
const/4 v0, -0x1
iput v0, p0, Lcom/a/k;->r:I
:goto_0
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
return-void
:catch_0
move-exception v0
:try_start_2
const-string v1, "UsbHostTransfer"
const-string v2, "closeUsbDevice"
invoke-static {v1, v2, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_1
const/4 v0, 0x0
:try_start_3
iput-object v0, p0, Lcom/a/k;->j:Landroid/hardware/usb/UsbInterface;
const/4 v0, 0x0
iput-object v0, p0, Lcom/a/k;->m:Landroid/hardware/usb/UsbDeviceConnection;
const/4 v0, 0x0
iput-object v0, p0, Lcom/a/k;->n:Landroid/hardware/usb/UsbEndpoint;
const/4 v0, 0x0
iput-object v0, p0, Lcom/a/k;->l:Landroid/hardware/usb/UsbEndpoint;
const/4 v0, 0x0
iput-object v0, p0, Lcom/a/k;->o:Landroid/hardware/usb/UsbEndpoint;
const/4 v0, 0x0
iput-object v0, p0, Lcom/a/k;->h:Landroid/hardware/usb/UsbDevice;
const/4 v0, 0x0
iput-boolean v0, p0, Lcom/a/k;->p:Z
const/4 v0, 0x0
iput-object v0, p0, Lcom/a/k;->i:Ljava/lang/String;
iget-object v0, p0, Lcom/a/k;->f:Lcom/a/c$d;
invoke-interface {v0}, Lcom/a/c$d;->b()V
iget-object v0, p0, Lcom/a/k;->g:Lcom/a/c$d;
invoke-interface {v0}, Lcom/a/c$d;->b()V
const/4 v0, -0x1
iput v0, p0, Lcom/a/k;->r:I
goto :goto_0
:catchall_0
move-exception v0
monitor-exit p0
:try_end_3
.catchall {:try_start_3 .. :try_end_3} :catchall_0
throw v0
:catchall_1
move-exception v0
const/4 v1, 0x0
:try_start_4
iput-object v1, p0, Lcom/a/k;->j:Landroid/hardware/usb/UsbInterface;
const/4 v1, 0x0
iput-object v1, p0, Lcom/a/k;->m:Landroid/hardware/usb/UsbDeviceConnection;
const/4 v1, 0x0
iput-object v1, p0, Lcom/a/k;->n:Landroid/hardware/usb/UsbEndpoint;
const/4 v1, 0x0
iput-object v1, p0, Lcom/a/k;->l:Landroid/hardware/usb/UsbEndpoint;
const/4 v1, 0x0
iput-object v1, p0, Lcom/a/k;->o:Landroid/hardware/usb/UsbEndpoint;
const/4 v1, 0x0
iput-object v1, p0, Lcom/a/k;->h:Landroid/hardware/usb/UsbDevice;
const/4 v1, 0x0
iput-boolean v1, p0, Lcom/a/k;->p:Z
const/4 v1, 0x0
iput-object v1, p0, Lcom/a/k;->i:Ljava/lang/String;
iget-object v1, p0, Lcom/a/k;->f:Lcom/a/c$d;
invoke-interface {v1}, Lcom/a/c$d;->b()V
iget-object v1, p0, Lcom/a/k;->g:Lcom/a/c$d;
invoke-interface {v1}, Lcom/a/c$d;->b()V
const/4 v1, -0x1
iput v1, p0, Lcom/a/k;->r:I
throw v0
:try_end_4
.catchall {:try_start_4 .. :try_end_4} :catchall_0
.end method
.method static synthetic e(Lcom/a/k;)V
.locals 0
invoke-direct {p0}, Lcom/a/k;->d()V
return-void
.end method
.method static synthetic f(Lcom/a/k;)I
.locals 1
iget v0, p0, Lcom/a/k;->r:I
return v0
.end method
.method static synthetic g(Lcom/a/k;)Landroid/hardware/usb/UsbDeviceConnection;
.locals 1
iget-object v0, p0, Lcom/a/k;->m:Landroid/hardware/usb/UsbDeviceConnection;
return-object v0
.end method
.method static synthetic h(Lcom/a/k;)Landroid/hardware/usb/UsbEndpoint;
.locals 1
iget-object v0, p0, Lcom/a/k;->n:Landroid/hardware/usb/UsbEndpoint;
return-object v0
.end method
.method static synthetic i(Lcom/a/k;)Ljava/lang/String;
.locals 1
iget-object v0, p0, Lcom/a/k;->i:Ljava/lang/String;
return-object v0
.end method
.method static synthetic j(Lcom/a/k;)Lcom/a/c$d;
.locals 1
iget-object v0, p0, Lcom/a/k;->f:Lcom/a/c$d;
return-object v0
.end method
.method static synthetic k(Lcom/a/k;)Landroid/hardware/usb/UsbEndpoint;
.locals 1
iget-object v0, p0, Lcom/a/k;->l:Landroid/hardware/usb/UsbEndpoint;
return-object v0
.end method
# virtual methods
.method public a(Landroid/content/Context;)V
.locals 2
invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
move-result-object v0
iput-object v0, p0, Lcom/a/k;->c:Landroid/content/Context;
iget-object v0, p0, Lcom/a/k;->c:Landroid/content/Context;
const-string v1, "usb"
invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/hardware/usb/UsbManager;
iput-object v0, p0, Lcom/a/k;->b:Landroid/hardware/usb/UsbManager;
return-void
.end method
.method a(Landroid/content/Context;Lcom/a/c$c;Lcom/a/c$d;Lcom/a/c$d;)V
.locals 3
iget-object v0, p0, Lcom/a/k;->c:Landroid/content/Context;
if-nez v0, :cond_0
invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
move-result-object v0
iput-object v0, p0, Lcom/a/k;->c:Landroid/content/Context;
:cond_0
iget-object v0, p0, Lcom/a/k;->b:Landroid/hardware/usb/UsbManager;
if-nez v0, :cond_1
iget-object v0, p0, Lcom/a/k;->c:Landroid/content/Context;
const-string v1, "usb"
invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/hardware/usb/UsbManager;
iput-object v0, p0, Lcom/a/k;->b:Landroid/hardware/usb/UsbManager;
:cond_1
new-instance v0, Lcom/a/k$a;
invoke-direct {v0, p0, p2}, Lcom/a/k$a;-><init>(Lcom/a/k;Lcom/a/c$c;)V
iput-object v0, p0, Lcom/a/k;->e:Lcom/a/c$c;
iput-object p3, p0, Lcom/a/k;->f:Lcom/a/c$d;
iput-object p4, p0, Lcom/a/k;->g:Lcom/a/c$d;
new-instance v0, Landroid/os/Handler;
invoke-direct {v0}, Landroid/os/Handler;-><init>()V
iput-object v0, p0, Lcom/a/k;->d:Landroid/os/Handler;
new-instance v0, Landroid/content/IntentFilter;
invoke-direct {v0}, Landroid/content/IntentFilter;-><init>()V
const-string v1, "android.hardware.usb.action.USB_DEVICE_ATTACHED"
invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V
const-string v1, "android.hardware.usb.action.USB_DEVICE_DETACHED"
invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V
const-string v1, "com.tcp2usb.usbhost.USB_PERMISSION"
invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V
iget-object v1, p0, Lcom/a/k;->c:Landroid/content/Context;
iget-object v2, p0, Lcom/a/k;->q:Landroid/content/BroadcastReceiver;
invoke-virtual {v1, v2, v0}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;
new-instance v0, Ljava/lang/Thread;
new-instance v1, Lcom/a/k$1;
invoke-direct {v1, p0}, Lcom/a/k$1;-><init>(Lcom/a/k;)V
invoke-direct {v0, v1}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;)V
invoke-virtual {v0}, Ljava/lang/Thread;->start()V
return-void
.end method
.method public a([BI)V
.locals 4
const/16 v0, 0x4000
if-le p2, v0, :cond_0
const-string v0, "UsbHostTransfer"
const-string v1, "throw new RuntimeException(\"Length too big:\" + len)"
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
new-instance v0, Ljava/lang/RuntimeException;
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "Length too big:"
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V
throw v0
:cond_0
monitor-enter p0
:try_start_0
iget-object v0, p0, Lcom/a/k;->m:Landroid/hardware/usb/UsbDeviceConnection;
if-nez v0, :cond_1
const-string v0, "UsbHostTransfer"
const-string v1, "throw new RuntimeException(\"bulkTransfer connection is null\")"
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
new-instance v0, Ljava/lang/RuntimeException;
const-string v1, "bulkTransfer connection is null"
invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V
throw v0
:catchall_0
move-exception v0
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw v0
:cond_1
:try_start_1
iget-object v0, p0, Lcom/a/k;->m:Landroid/hardware/usb/UsbDeviceConnection;
iget-object v1, p0, Lcom/a/k;->o:Landroid/hardware/usb/UsbEndpoint;
const/16 v2, 0x2710
invoke-virtual {v0, v1, p1, p2, v2}, Landroid/hardware/usb/UsbDeviceConnection;->bulkTransfer(Landroid/hardware/usb/UsbEndpoint;[BII)I
move-result v0
if-eq v0, p2, :cond_2
const-string v1, "UsbHostTransfer"
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "write length error "
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v0
const-string v2, " != "
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-static {v1, v0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
:goto_0
monitor-exit p0
return-void
:cond_2
const-string v0, "UsbHostTransfer"
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "Write data len "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, " ok "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
goto :goto_0
.end method
.method public a(Landroid/hardware/usb/UsbDevice;)Z
.locals 4
const/4 v3, 0x0
iget-object v0, p0, Lcom/a/k;->b:Landroid/hardware/usb/UsbManager;
invoke-virtual {v0, p1}, Landroid/hardware/usb/UsbManager;->hasPermission(Landroid/hardware/usb/UsbDevice;)Z
move-result v0
if-eqz v0, :cond_0
const-string v0, "UsbHostTransfer"
const-string v1, "tryOpenOurUsbDevice call With Permission"
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
invoke-direct {p0, p1}, Lcom/a/k;->b(Landroid/hardware/usb/UsbDevice;)Z
:goto_0
const/4 v0, 0x1
return v0
:cond_0
const-string v0, "UsbHostTransfer"
const-string v1, "tryOpenOurUsbDevice call Without Permission, request Permission"
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
iget-object v0, p0, Lcom/a/k;->c:Landroid/content/Context;
new-instance v1, Landroid/content/Intent;
const-string v2, "com.tcp2usb.usbhost.USB_PERMISSION"
invoke-direct {v1, v2}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
invoke-static {v0, v3, v1, v3}, Landroid/app/PendingIntent;->getBroadcast(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent;
move-result-object v0
iget-object v1, p0, Lcom/a/k;->b:Landroid/hardware/usb/UsbManager;
invoke-virtual {v1, p1, v0}, Landroid/hardware/usb/UsbManager;->requestPermission(Landroid/hardware/usb/UsbDevice;Landroid/app/PendingIntent;)V
goto :goto_0
.end method
.method public b()V
.locals 2
const-string v0, "UsbHostTransfer"
const-string v1, "deinit host side"
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
monitor-enter p0
:try_start_0
iget-object v0, p0, Lcom/a/k;->q:Landroid/content/BroadcastReceiver;
if-eqz v0, :cond_0
iget-object v0, p0, Lcom/a/k;->c:Landroid/content/Context;
iget-object v1, p0, Lcom/a/k;->q:Landroid/content/BroadcastReceiver;
invoke-virtual {v0, v1}, Landroid/content/Context;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V
const/4 v0, 0x0
iput-object v0, p0, Lcom/a/k;->q:Landroid/content/BroadcastReceiver;
:cond_0
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
invoke-direct {p0}, Lcom/a/k;->d()V
return-void
:catchall_0
move-exception v0
:try_start_1
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw v0
.end method