Install apk and choose what our soft button will perform. I'm in this application will be done by pressing the volume keys down and it will perform the action "Start Service" button.
Next decompile agribusiness, and in my case, we will begin the search for a strings.xml, will be there to look for the text "Start Service", and we find:
<string name = "start_server">Start Service</ string>
Copy what I have highlighted in red above.
Next, do a search on the resources in the layout folder, and if nothing is found, you are looking for is in public.xml and see there is this:
<public type = "string" name = "start_server" id = "0x7f060025" />
Again, copy that highlighted in red above, continue to do this in the search smali.
In my case file smali / com / mbapp / ftpserver / MainActivity.smali I found this:
goto / 16: goto_c3
.line 350
.end local v1 # "address": Ljava / net / InetAddress;
.end local v2 # "context": Landroid / content / Context;
.end local v4 # "intent": Landroid / content / Intent;
.restart local v8 # "startStopButtonText": Landroid / widget / TextView;
: cond_15e
const v13, 0x7f060025
goto / 16: goto_dc
We pass on the label: goto_dc and see:
invoke-virtual {v13, v5}, Landroid / view / View; ->setEnabled (Z) V
.line 348
const v13, 0x7f050010
move-object / from16 v0, p0
invoke-virtual {v0, v13}, Lcom / mbapp / ftpserver / MainActivity; ->findViewById (I) Landroid / view / View;
move-result-object v8
check-cast v8, Landroid / widget / TextView;
.line 349
.local v8, "startStopButtonText": Landroid / widget / TextView;
if-eqz v5,: cond_174
.line 350
if-eqz v7,: cond_15e
const v13, 0x7f060026
: goto_dc
invoke-virtual {v8, v13}, Landroid / widget / TextView; ->setText (I) V
.line 351
if-eqz v7,: cond_163
Our button v13 stored in the register and placed in the register v8 (which is TextView) as text.
Next ischim above what is the v8 and see
const v13, 0x7f050010
move-object / from16 v0, p0
invoke-virtual {v0, v13}, Lcom / mbapp / ftpserver / MainActivity; ->findViewById (I) Landroid / view / View;
move-result-object v8
check-cast v8, Landroid / widget / TextView;
Our TextView from v8 register has its own id resource 0x7f050010.Dalee go back to resources and file public.xml ischim 0x7f050010 and find:
<public type = "id" name = "start_stop_button_text" id = "0x7f050010" />
Next, take away start_stop_button_text and looking at layout of the text. And we find it in the presence of server_control_activity.xml file:
<LinearLayout android: gravity = "center" android: layout_gravity = "center_horizontal" android: id = "@ id / start_stop_button" android: background = "@ drawable / btn_bottom_last" android: layout_width = "274.0dip" android: layout_height = "wrap_content" android: layout_marginTop = "20.0dip" android: layout_marginBottom = "20.0dip">
<TextView android: textSize = "20.0sp" android: gravity = "center" android: id = "@ id / start_stop_button_text" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: drawablePadding = "10.0dip" />
</ LinearLayout>
And above linearlayput in which it is therefore possible to say that pressing takes place on LinearLayout, and we therefore take it id start_stop_button here and looking at public.xml and find:
<public type = "id" name = "start_stop_button" id = "0x7f05000f" />
Copy 0x7f05000f and do a search for this in smali:
const v1, 0x7f05000f
invoke-virtual {p0, v1}, Lcom / mbapp / ftpserver / MainActivity; ->findViewById (I) Landroid / view / View;
move-result-object v1
iput-object v1, p0, Lcom / mbapp / ftpserver / MainActivity; ->startStopButton: Landroid / view / View;
Here in the registers, we can see that it is entered in the field
Lcom / mbapp / ftpserver / MainActivity; ->startStopButton: Landroid / view / View;
and do search smali this polyu.Teper we are interested in the moment when the register with this field invokes the setOnClickListener.I find:
iget-object v1, p0, Lcom / mbapp / ftpserver / MainActivity; ->startStopButton: Landroid / view / View;
iget-object v2, p0, Lcom / mbapp / ftpserver / MainActivity; ->startStopListener: Landroid / view / View $ OnClickListener;
invoke-virtual {v1, v2}, Landroid / view / View; ->setOnClickListener (Landroid / view / View $ OnClickListener;) V
Now we are interested in the content field
Lcom / mbapp / ftpserver / MainActivity; ->startStopListener: Landroid / view / View $ OnClickListener;
Because That it contains our smali class nazhatiem.Nam need to find the place where this field is filled, and we find:
new-instance v0, Lcom / mbapp / ftpserver / MainActivity $ 3;
invoke-direct {v0, p0}, Lcom / mbapp / ftpserver / MainActivity $ 3 -><init>(Lcom / mbapp / ftpserver / MainActivity;) V
iput-object v0, p0, Lcom / mbapp / ftpserver / MainActivity; ->startStopListener: Landroid / view / View $ OnClickListener;
Where Lcom / mbapp / ftpserver / MainActivity $ 3; our class to go along the way nazhatiem.Dalee smali / com / mbapp / ftpserver / MainActivity $ 3.smali and method ischim there
onClick (Landroid / view / View;) V
.method public onClick (Landroid / view / View;) V
.registers 7
.param p1, "v" # Landroid / view / View;
.prologue
.line 390
const / 4 v3, 0x0
invoke-static {v3}, Lorg / swiftp / Globals; ->setLastError (Ljava / lang / String;) V
.line 391
new-instance v0, Ljava / io / File;
sget-object v3, Lorg / swiftp / Defaults; ->chrootDir: Ljava / lang / String;
invoke-direct {v0, v3}, Ljava / io / File; -><init>(Ljava / lang / String;) V
.line 392
.local v0, "chrootDir": Ljava / io / File;
invoke-virtual {v0}, Ljava / io / File; ->isDirectory () Z
move-result v3
if-nez v3,: cond_12
.line 411
: cond_11
: goto_11
return-void
.line 395
: cond_12
iget-object v3, p0, Lcom / mbapp / ftpserver / MainActivity $ 3 ->the this $ 0: Lcom / mbapp / ftpserver / MainActivity;
invoke-virtual {v3}, Lcom / mbapp / ftpserver / MainActivity; ->getApplicationContext () Landroid / content / Context;
move-result-object v1
.line 396
.local v1, "context": Landroid / content / Context;
new-instance v2, Landroid / content / Intent;
const-class v3, Lcom / mbapp / ftpserver / FTPServerService;
invoke-direct {v2, v1, v3}, Landroid / content / Intent; -><init>(Landroid / content / Context; Ljava / lang / Class;) V
.line 398
.local v2, "intent": Landroid / content / Intent;
invoke-static {v0}, Lorg / swiftp / Globals; ->setChrootDir (Ljava / io / File;) V
.line 399
const-string v3, "onClick ===>"
invoke-static {v3}, Lcom / mbapp / ftpserver / MainActivity; ->log (Ljava / lang / String;) V
.line 400
invoke-static {}, Lcom / mbapp / ftpserver / FTPServerService; ->isRunning () Z
move-result v3
if-nez v3,: cond_4c
.line 401
const-string v3, "FTPServerService.isRunning =>"
invoke-static {v3}, Lcom / mbapp / ftpserver / MainActivity; ->log (Ljava / lang / String;) V
.line 402
iget-object v3, p0, Lcom / mbapp / ftpserver / MainActivity $ 3 ->the this $ 0: Lcom / mbapp / ftpserver / MainActivity;
invoke-static {v3}, Lcom / mbapp / ftpserver / MainActivity; ->access $ 1 (Lcom / mbapp / ftpserver / MainActivity;) V
.line 403
const-string v3, "mounted"
invoke-static {}, Landroid / os / Environment; ->getExternalStorageState () Ljava / lang / String;
move-result-object v4
invoke-virtual {v3, v4}, Ljava / lang / String; ->equals (Ljava / lang / Object;) Z
move-result v3
if-eqz v3,: cond_11
.line 404
const-string v3, "startService"
invoke-static {v3}, Lcom / mbapp / ftpserver / MainActivity; ->log (Ljava / lang / String;) V
.line 405
invoke-virtual {v1, v2}, Landroid / content / Context; ->startService (Landroid / content / Intent;) Landroid / content / ComponentName;
goto: goto_11
.line 408
: cond_4c
const-string v3, "FTPServerService.isStopped"
invoke-static {v3}, Lcom / mbapp / ftpserver / MainActivity; ->log (Ljava / lang / String;) V
.line 409
invoke-virtual {v1, v2}, Landroid / content / Context; ->stopService (Landroid / content / Intent;) Z
goto: goto_11
.end method
Further, thanks to the second line in this file smali we understand that this is not the activity:
.super ljava / lang / Object;
So he gets a context, which would manage the Activiti. Our same method will Activiti and it is enough to cause us to register p0 contexta.
Next, copy the method into your text document and modify ego.V my case they receive a context as follows:
iget-object v3, p0, Lcom / mbapp / ftpserver / MainActivity $ 3 ->the this $ 0: Lcom / mbapp / ftpserver / MainActivity;
And all this can be replaced byaku in my case,
or simply instead v3 izat register p0, and field challenge simply erased.
Then we go to our Activiti. In my case it smali / com / mbapp / ftpserver / MainActivity.smali and added to 2 methods:
.method public onKeyDown (ILandroid / view / KeyEvent;) Z
.registers 10
.annotation runtime Ljava / lang / Override;
.end annotation
.prologue
.line 24
move-object v0, p0
move v1, p1
move-object v2, p2
move v4, v1
const / 16 v5, 0x19
if-ne v4, v5,: cond_c
.line 27
move-object v4, v0
invoke-virtual {v4}, Lcom / mbapp / ftpserver / MainActivity; ->doOnClickKey () V
.line 29
: cond_c
move-object v4, v0
move v5, v1
move-object v6, v2
invoke-super {v4, v5, v6}, Landroid / app / Activity; ->onKeyDown (ILandroid / view / KeyEvent;) Z
move-result v4
move v0, v4
return v0
.end method
.method public doOnClickKey () V
.registers 7
.prologue
.line 390
const / 4 v3, 0x0
invoke-static {v3}, Lorg / swiftp / Globals; ->setLastError (Ljava / lang / String;) V
.line 391
new-instance v0, Ljava / io / File;
sget-object v3, Lorg / swiftp / Defaults; ->chrootDir: Ljava / lang / String;
invoke-direct {v0, v3}, Ljava / io / File; -><init>(Ljava / lang / String;) V
.line 392
.local v0, "chrootDir": Ljava / io / File;
invoke-virtual {v0}, Ljava / io / File; ->isDirectory () Z
move-result v3
if-nez v3,: cond_12
.line 411
: cond_11
: goto_11
return-void
.line 395
: cond_12
invoke-virtual {p0}, Lcom / mbapp / ftpserver / MainActivity; ->getApplicationContext () Landroid / content / Context;
move-result-object v1
.line 396
.local v1, "context": Landroid / content / Context;
new-instance v2, Landroid / content / Intent;
const-class v3, Lcom / mbapp / ftpserver / FTPServerService;
invoke-direct {v2, v1, v3}, Landroid / content / Intent; -><init>(Landroid / content / Context; Ljava / lang / Class;) V
.line 398
.local v2, "intent": Landroid / content / Intent;
invoke-static {v0}, Lorg / swiftp / Globals; ->setChrootDir (Ljava / io / File;) V
.line 399
const-string v3, "onClick ===>"
invoke-static {v3}, Lcom / mbapp / ftpserver / MainActivity; ->log (Ljava / lang / String;) V
.line 400
invoke-static {}, Lcom / mbapp / ftpserver / FTPServerService; ->isRunning () Z
move-result v3
if-nez v3,: cond_4c
.line 401
const-string v3, "FTPServerService.isRunning =>"
invoke-static {v3}, Lcom / mbapp / ftpserver / MainActivity; ->log (Ljava / lang / String;) V
.line 402
invoke-direct {p0}, Lcom / mbapp / ftpserver / MainActivity; ->warnIfNoExternalStorage () V
.line 403
const-string v3, "mounted"
invoke-static {}, Landroid / os / Environment; ->getExternalStorageState () Ljava / lang / String;
move-result-object v4
invoke-virtual {v3, v4}, Ljava / lang / String; ->equals (Ljava / lang / Object;) Z
move-result v3
if-eqz v3,: cond_11
.line 404
const-string v3, "startService"
invoke-static {v3}, Lcom / mbapp / ftpserver / MainActivity; ->log (Ljava / lang / String;) V
.line 405
invoke-virtual {v1, v2}, Landroid / content / Context; ->startService (Landroid / content / Intent;) Landroid / content / ComponentName;
goto: goto_11
.line 408
: cond_4c
const-string v3, "FTPServerService.isStopped"
invoke-static {v3}, Lcom / mbapp / ftpserver / MainActivity; ->log (Ljava / lang / String;) V
.line 409
invoke-virtual {v1, v2}, Landroid / content / Context; ->stopService (Landroid / content / Intent;) Z
goto: goto_11
.end method
Where the contents of the method doOnClickKey () V our retouched method onClick, and in the method onKeyDown (ILandroid / view / KeyEvent;) Z 0x19 is a button code (in my case, this reduction in volume), all buttons can be found here:
https: //developer.andr..aoid/view/KeyEvent.htmlCompile and rejoice) Sometimes it happens that the method onKeyDown (ILandroid / view / KeyEvent;) Z already have and then at the very beginning, we add:
move-object v0, p0
move v1, p1
const / 16 v2, 0x19
if-ne v1, v2,: cond_c
invoke-virtual {v0}, Lcom / mbapp / ftpserver / MainActivity; ->doOnClickKey () V
: cond_c
But you can do simply with p1 and p0) Then we get our nazhatie.Gotovy version here:
Club Mod APK (Post keks40 # 66197476)