.class Lcom/viatech/update/UpgradeDeviceActivity$3; .super Ljava/lang/Object; .source "UpgradeDeviceActivity.java" # interfaces .implements Ljava/lang/Runnable; # annotations .annotation system Ldalvik/annotation/EnclosingMethod; value = Lcom/viatech/update/UpgradeDeviceActivity;->createUpgradeTCPServer()V .end annotation .annotation system Ldalvik/annotation/InnerClass; accessFlags = 0x0 name = null .end annotation # instance fields .field final synthetic this$0:Lcom/viatech/update/UpgradeDeviceActivity; # direct methods .method constructor (Lcom/viatech/update/UpgradeDeviceActivity;)V .locals 0 .prologue .line 584 iput-object p1, p0, Lcom/viatech/update/UpgradeDeviceActivity$3;->this$0:Lcom/viatech/update/UpgradeDeviceActivity; invoke-direct {p0}, Ljava/lang/Object;->()V return-void .end method # virtual methods .method public run()V .locals 14 .prologue .line 588 .line 589 const/16 v1, 0x2212 .line 590 const/16 v2, 0x14 .line 591 const/16 v0, 0x400 :try_start_0 new-array v3, v0, [B .line 592 const/4 v0, 0x0 .line 593 const/16 v4, 0x14 new-array v4, v4, [B .line 594 new-instance v5, Ljava/net/ServerSocket; invoke-direct {v5, v1}, Ljava/net/ServerSocket;->(I)V .line 595 const-string v6, "Vpai_Upgrade" new-instance v7, Ljava/lang/StringBuilder; invoke-direct {v7}, Ljava/lang/StringBuilder;->()V const-string v8, "Server binded at " invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v7 invoke-virtual {v5}, Ljava/net/ServerSocket;->getInetAddress()Ljava/net/InetAddress; invoke-static {}, Ljava/net/InetAddress;->getLocalHost()Ljava/net/InetAddress; move-result-object v8 invoke-virtual {v8}, Ljava/net/InetAddress;->getHostAddress()Ljava/lang/String; move-result-object v8 invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v7 const-string v8, ":" invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v7 invoke-virtual {v7, v1}, 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-static {v6, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I .line 596 :goto_0 iget-object v1, p0, Lcom/viatech/update/UpgradeDeviceActivity$3;->this$0:Lcom/viatech/update/UpgradeDeviceActivity; invoke-static {v1}, Lcom/viatech/update/UpgradeDeviceActivity;->access$200(Lcom/viatech/update/UpgradeDeviceActivity;)I move-result v1 const/4 v6, 0x6 if-eq v1, v6, :cond_2 iget-object v1, p0, Lcom/viatech/update/UpgradeDeviceActivity$3;->this$0:Lcom/viatech/update/UpgradeDeviceActivity; invoke-static {v1}, Lcom/viatech/update/UpgradeDeviceActivity;->access$200(Lcom/viatech/update/UpgradeDeviceActivity;)I move-result v1 const/4 v6, 0x5 if-eq v1, v6, :cond_2 .line 597 invoke-virtual {v5}, Ljava/net/ServerSocket;->accept()Ljava/net/Socket; move-result-object v1 .line 598 invoke-virtual {v1}, Ljava/net/Socket;->getRemoteSocketAddress()Ljava/net/SocketAddress; move-result-object v6 .line 599 const-string v7, "Vpai_Upgrade" new-instance v8, Ljava/lang/StringBuilder; invoke-direct {v8}, Ljava/lang/StringBuilder;->()V const-string v9, "Handling client at " invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v8 invoke-virtual {v8, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object v6 invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v6 invoke-static {v7, v6}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I .line 600 invoke-virtual {v1}, Ljava/net/Socket;->getInputStream()Ljava/io/InputStream; move-result-object v6 .line 601 invoke-virtual {v1}, Ljava/net/Socket;->getOutputStream()Ljava/io/OutputStream; .line 602 const/4 v7, 0x0 invoke-static {v4, v7}, Ljava/util/Arrays;->fill([BB)V .line 603 :cond_0 invoke-virtual {v6, v4}, Ljava/io/InputStream;->read([B)I move-result v7 const/4 v8, -0x1 if-eq v7, v8, :cond_3 .line 604 const/4 v8, 0x0 invoke-static {v4, v0, v3, v8, v7}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V .line 605 add-int/2addr v0, v7 .line 606 const-string v7, "Vpai_Upgrade" new-instance v8, Ljava/lang/StringBuilder; invoke-direct {v8}, Ljava/lang/StringBuilder;->()V const-string v9, "------receivTCPBuf(" invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v8 invoke-virtual {v8, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v8 const-string v9, "):" invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v8 const/4 v9, 0x0 aget-byte v9, v3, v9 and-int/lit16 v9, v9, 0xff invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v8 const-string v9, "," invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v8 const/4 v9, 0x1 aget-byte v9, v3, v9 and-int/lit16 v9, v9, 0xff invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v8 const-string v9, "," invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v8 const/4 v9, 0x2 aget-byte v9, v3, v9 and-int/lit16 v9, v9, 0xff invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v8 const-string v9, "," invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v8 const/4 v9, 0x3 aget-byte v9, v3, v9 and-int/lit16 v9, v9, 0xff invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v8 const-string v9, "," invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v8 const/4 v9, 0x4 aget-byte v9, v3, v9 and-int/lit16 v9, v9, 0xff invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v8 const-string v9, " | " invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v8 const/4 v9, 0x5 aget-byte v9, v3, v9 and-int/lit16 v9, v9, 0xff invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v8 const-string v9, "," invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v8 const/4 v9, 0x6 aget-byte v9, v3, v9 invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v8 const-string v9, "," invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v8 const/4 v9, 0x7 aget-byte v9, v3, v9 invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v8 invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v8 invoke-static {v7, v8}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I .line 608 :goto_1 if-lt v0, v2, :cond_0 const/4 v7, 0x0 aget-byte v7, v3, v7 and-int/lit16 v7, v7, 0xff const/16 v8, 0xac if-ne v7, v8, :cond_0 const/4 v7, 0x1 aget-byte v7, v3, v7 and-int/lit16 v7, v7, 0xff const/16 v8, 0xbd if-ne v7, v8, :cond_0 const/4 v7, 0x2 aget-byte v7, v3, v7 and-int/lit16 v7, v7, 0xff const/16 v8, 0x83 if-ne v7, v8, :cond_0 const/4 v7, 0x3 aget-byte v7, v3, v7 and-int/lit16 v7, v7, 0xff const/4 v8, 0x3 if-ne v7, v8, :cond_0 const/4 v7, 0x4 aget-byte v7, v3, v7 and-int/lit16 v7, v7, 0xff if-nez v7, :cond_0 .line 610 iget-object v7, p0, Lcom/viatech/update/UpgradeDeviceActivity$3;->this$0:Lcom/viatech/update/UpgradeDeviceActivity; invoke-static {v7}, Lcom/viatech/update/UpgradeDeviceActivity;->access$1000(Lcom/viatech/update/UpgradeDeviceActivity;)Lcom/viatech/update/UpdateManager; move-result-object v7 invoke-virtual {v7}, Lcom/viatech/update/UpdateManager;->getUpgradeHandler()Landroid/os/Handler; move-result-object v7 .line 611 if-eqz v7, :cond_1 const/4 v8, 0x5 aget-byte v8, v3, v8 const/16 v9, 0x50 if-ne v8, v9, :cond_1 .line 612 new-instance v8, Landroid/os/Message; invoke-direct {v8}, Landroid/os/Message;->()V .line 613 const/16 v9, 0x3ee iput v9, v8, Landroid/os/Message;->what:I .line 614 const/16 v9, 0x50 iput v9, v8, Landroid/os/Message;->arg1:I .line 615 new-instance v9, Landroid/os/Bundle; invoke-direct {v9}, Landroid/os/Bundle;->()V .line 616 const/16 v10, 0xa new-array v10, v10, [B .line 617 const/16 v11, 0xc const/4 v12, 0x0 const/16 v13, 0x8 invoke-static {v3, v11, v10, v12, v13}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V .line 618 const-string v11, "payload" invoke-virtual {v9, v11, v10}, Landroid/os/Bundle;->putByteArray(Ljava/lang/String;[B)V .line 619 invoke-virtual {v8, v9}, Landroid/os/Message;->setData(Landroid/os/Bundle;)V .line 620 invoke-virtual {v7, v8}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z .line 622 :cond_1 const/16 v7, 0x400 new-array v7, v7, [B .line 623 sub-int/2addr v0, v2 .line 624 const/4 v8, 0x0 invoke-static {v3, v2, v7, v8, v0}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V .line 625 const/4 v8, 0x0 invoke-static {v3, v8}, Ljava/util/Arrays;->fill([BB)V .line 626 const/4 v8, 0x0 const/4 v9, 0x0 invoke-static {v7, v8, v3, v9, v0}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V :try_end_0 .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0 goto :goto_1 .line 632 :catch_0 move-exception v0 .line 633 const-string v1, "Vpai_Upgrade" const-string v2, "TCP Server error!" invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I .line 634 sget-object v1, Ljava/lang/System;->err:Ljava/io/PrintStream; new-instance v2, Ljava/lang/StringBuilder; invoke-direct {v2}, Ljava/lang/StringBuilder;->()V const-string v3, "* err" 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(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object v0 invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v0 invoke-virtual {v1, v0}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V .line 636 iget-object v0, p0, Lcom/viatech/update/UpgradeDeviceActivity$3;->this$0:Lcom/viatech/update/UpgradeDeviceActivity; invoke-static {v0}, Lcom/viatech/update/UpgradeDeviceActivity;->access$300(Lcom/viatech/update/UpgradeDeviceActivity;)Landroid/os/Handler; move-result-object v0 const/16 v1, 0x3f2 invoke-virtual {v0, v1}, Landroid/os/Handler;->sendEmptyMessage(I)Z .line 638 :cond_2 return-void .line 629 :cond_3 :try_start_1 invoke-virtual {v6}, Ljava/io/InputStream;->close()V .line 630 invoke-virtual {v1}, Ljava/net/Socket;->close()V :try_end_1 .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0 goto/16 :goto_0 .end method