[Sprint HTC EVO 4G LTE] Sinistertensai:
cause there's an available syntax key for this, and other sense smali...

.class public Lcom/android/systemui/usb/UsbResolverActivity;
.super Lcom/android/internal/app/ResolverActivity;
.source "UsbResolverActivity.java"

# static fields
.field public static final EXTRA_RESOLVE_INFOS:Ljava/lang/String; = "rlist"

.field public static final TAG:Ljava/lang/String; = "UsbResolverActivity"

# instance fields
.field private mAccessory:Landroid/hardware/usb/UsbAccessory;

.field private mDevice:Landroid/hardware/usb/UsbDevice;

.field private mDisconnectedReceiver:Lcom/android/systemui/usb/UsbDisconnectedReceiver;

# direct methods
.method public constructor <init>()V
.locals 0

invoke-direct {p0}, Lcom/android/internal/app/ResolverActivity;-><init>()V

return-void
.end method

# virtual methods
.method protected onCreate(Landroid/os/Bundle;)V
.locals 10

invoke-virtual {p0}, Lcom/android/systemui/usb/UsbResolverActivity;->getIntent()Landroid/content/Intent;

move-result-object v8

const-string v0, "android.intent.extra.INTENT"

invoke-virtual {v8, v0}, Landroid/content/Intent;->getParcelableExtra(Ljava/lang/String;)Landroid/os/Parcelable;

move-result-object v9

instance-of v0, v9, Landroid/content/Intent;

if-nez v0, :cond_2a

const-string v0, "UsbResolverActivity"

new-instance v1, Ljava/lang/StringBuilder;

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

const-string v4, "Target is not an intent: "

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

move-result-object v1

invoke-virtual {v1, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)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;->w(Ljava/lang/String;Ljava/lang/String;)I

invoke-virtual {p0}, Lcom/android/systemui/usb/UsbResolverActivity;->finish()V

:goto_29
return-void

:cond_2a
move-object v2, v9

check-cast v2, Landroid/content/Intent;

const-string v0, "rlist"

invoke-virtual {v8, v0}, Landroid/content/Intent;->getParcelableArrayListExtra(Ljava/lang/String;)Ljava/util/ArrayList;

move-result-object v5

invoke-virtual {p0}, Lcom/android/systemui/usb/UsbResolverActivity;->getResources()Landroid/content/res/Resources;

move-result-object v0

const v1, 0x10403b8

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getText(I)Ljava/lang/CharSequence;

move-result-object v3

const/4 v4, 0x0

const/4 v6, 0x1

move-object v0, p0

move-object v1, p1

invoke-super/range {v0 .. v6}, Lcom/android/internal/app/ResolverActivity;->onCreate(Landroid/os/Bundle;Landroid/content/Intent;Ljava/lang/CharSequence;[Landroid/content/Intent;Ljava/util/List;Z)V

const v0, 0x1020245

invoke-virtual {p0, v0}, Lcom/android/systemui/usb/UsbResolverActivity;->findViewById(I)Landroid/view/View;

move-result-object v7

check-cast v7, Landroid/widget/CheckBox;

if-eqz v7, :cond_5a

iget-object v0, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mDevice:Landroid/hardware/usb/UsbDevice;

if-nez v0, :cond_72

const v0, 0x7f080028

invoke-virtual {v7, v0}, Landroid/widget/CheckBox;->setText(I)V

:cond_5a
:goto_5a
const-string v0, "device"

invoke-virtual {v2, v0}, Landroid/content/Intent;->getParcelableExtra(Ljava/lang/String;)Landroid/os/Parcelable;

move-result-object v0

check-cast v0, Landroid/hardware/usb/UsbDevice;

iput-object v0, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mDevice:Landroid/hardware/usb/UsbDevice;

iget-object v0, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mDevice:Landroid/hardware/usb/UsbDevice;

if-eqz v0, :cond_79

new-instance v0, Lcom/android/systemui/usb/UsbDisconnectedReceiver;

iget-object v1, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mDevice:Landroid/hardware/usb/UsbDevice;

invoke-direct {v0, p0, v1}, Lcom/android/systemui/usb/UsbDisconnectedReceiver;-><init>(Landroid/app/Activity;Landroid/hardware/usb/UsbDevice;)V

iput-object v0, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mDisconnectedReceiver:Lcom/android/systemui/usb/UsbDisconnectedReceiver;

goto :goto_29

:cond_72
const v0, 0x7f080027

invoke-virtual {v7, v0}, Landroid/widget/CheckBox;->setText(I)V

goto :goto_5a

:cond_79
const-string v0, "accessory"

invoke-virtual {v2, v0}, Landroid/content/Intent;->getParcelableExtra(Ljava/lang/String;)Landroid/os/Parcelable;

move-result-object v0

check-cast v0, Landroid/hardware/usb/UsbAccessory;

iput-object v0, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mAccessory:Landroid/hardware/usb/UsbAccessory;

iget-object v0, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mAccessory:Landroid/hardware/usb/UsbAccessory;

if-nez v0, :cond_92

const-string v0, "UsbResolverActivity"

const-string v1, "no device or accessory"

invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

invoke-virtual {p0}, Lcom/android/systemui/usb/UsbResolverActivity;->finish()V

goto :goto_29

:cond_92
new-instance v0, Lcom/android/systemui/usb/UsbDisconnectedReceiver;

iget-object v1, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mAccessory:Landroid/hardware/usb/UsbAccessory;

invoke-direct {v0, p0, v1}, Lcom/android/systemui/usb/UsbDisconnectedReceiver;-><init>(Landroid/app/Activity;Landroid/hardware/usb/UsbAccessory;)V

iput-object v0, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mDisconnectedReceiver:Lcom/android/systemui/usb/UsbDisconnectedReceiver;

goto :goto_29
.end method

.method protected onDestroy()V
.locals 1

iget-object v0, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mDisconnectedReceiver:Lcom/android/systemui/usb/UsbDisconnectedReceiver;

if-eqz v0, :cond_9

iget-object v0, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mDisconnectedReceiver:Lcom/android/systemui/usb/UsbDisconnectedReceiver;

invoke-virtual {p0, v0}, Lcom/android/systemui/usb/UsbResolverActivity;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V

:cond_9
invoke-super {p0}, Lcom/android/internal/app/ResolverActivity;->onDestroy()V

return-void
.end method

.method protected onIntentSelected(Landroid/content/pm/ResolveInfo;Landroid/content/Intent;Z)V
.locals 6

:try_start_0
const-string v4, "usb"

invoke-static {v4}, Landroid/os/ServiceManager;->getService(Ljava/lang/String;)Landroid/os/IBinder;

move-result-object v0

invoke-static {v0}, Landroid/hardware/usb/IUsbManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/usb/IUsbManager;

move-result-object v2

iget-object v4, p1, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

iget-object v4, v4, Landroid/content/pm/ActivityInfo;->applicationInfo:Landroid/content/pm/ApplicationInfo;

iget v3, v4, Landroid/content/pm/ApplicationInfo;->uid:I

iget-object v4, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mDevice:Landroid/hardware/usb/UsbDevice;

if-eqz v4, :cond_38

iget-object v4, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mDevice:Landroid/hardware/usb/UsbDevice;

invoke-interface {v2, v4, v3}, Landroid/hardware/usb/IUsbManager;->grantDevicePermission(Landroid/hardware/usb/UsbDevice;I)V

if-eqz p3, :cond_28

iget-object v4, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mDevice:Landroid/hardware/usb/UsbDevice;

iget-object v5, p1, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

iget-object v5, v5, Landroid/content/pm/ActivityInfo;->packageName:Ljava/lang/String;

invoke-interface {v2, v4, v5}, Landroid/hardware/usb/IUsbManager;->setDevicePackage(Landroid/hardware/usb/UsbDevice;Ljava/lang/String;)V
:try_end_24
.catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_24} :catch_2f

:cond_24
:goto_24
:try_start_24
invoke-virtual {p0, p2}, Lcom/android/systemui/usb/UsbResolverActivity;->startActivity(Landroid/content/Intent;)V
:try_end_27
.catch Landroid/content/ActivityNotFoundException; {:try_start_24 .. :try_end_27} :catch_54
.catch Landroid/os/RemoteException; {:try_start_24 .. :try_end_27} :catch_2f

:goto_27
return-void

:cond_28
:try_start_28
iget-object v4, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mDevice:Landroid/hardware/usb/UsbDevice;

const/4 v5, 0x0

invoke-interface {v2, v4, v5}, Landroid/hardware/usb/IUsbManager;->setDevicePackage(Landroid/hardware/usb/UsbDevice;Ljava/lang/String;)V
:try_end_2e
.catch Landroid/os/RemoteException; {:try_start_28 .. :try_end_2e} :catch_2f

goto :goto_24

:catch_2f
move-exception v1

const-string v4, "UsbResolverActivity"

const-string v5, "onIntentSelected failed"

invoke-static {v4, v5, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

goto :goto_27

:cond_38
:try_start_38
iget-object v4, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mAccessory:Landroid/hardware/usb/UsbAccessory;

if-eqz v4, :cond_24

iget-object v4, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mAccessory:Landroid/hardware/usb/UsbAccessory;

invoke-interface {v2, v4, v3}, Landroid/hardware/usb/IUsbManager;->grantAccessoryPermission(Landroid/hardware/usb/UsbAccessory;I)V

if-eqz p3, :cond_4d

iget-object v4, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mAccessory:Landroid/hardware/usb/UsbAccessory;

iget-object v5, p1, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

iget-object v5, v5, Landroid/content/pm/ActivityInfo;->packageName:Ljava/lang/String;

invoke-interface {v2, v4, v5}, Landroid/hardware/usb/IUsbManager;->setAccessoryPackage(Landroid/hardware/usb/UsbAccessory;Ljava/lang/String;)V

goto :goto_24

:cond_4d
iget-object v4, p0, Lcom/android/systemui/usb/UsbResolverActivity;->mAccessory:Landroid/hardware/usb/UsbAccessory;

const/4 v5, 0x0

invoke-interface {v2, v4, v5}, Landroid/hardware/usb/IUsbManager;->setAccessoryPackage(Landroid/hardware/usb/UsbAccessory;Ljava/lang/String;)V

goto :goto_24

:catch_54
move-exception v1

const-string v4, "UsbResolverActivity"

const-string v5, "startActivity failed"

invoke-static {v4, v5, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:try_end_5c
.catch Landroid/os/RemoteException; {:try_start_38 .. :try_end_5c} :catch_2f

goto :goto_27
.end method

point is: can't build rome in a day. and the blueprints are half assed as well.