[Plugin] Remote Adb Shell

Humpie

Recognized Developer
Dec 23, 2010
1,370
337
103
jolanrensen.nl
Can you share your source code on github?
Good idea! I certainly will, look forward to it
However, the truth is, my project is a mess, currently it won't even compile (due to old Tasker plugin templates combined with new android studio stuff). When I get it up and running again I can upload it
 
Last edited:

Humpie

Recognized Developer
Dec 23, 2010
1,370
337
103
jolanrensen.nl
True, it has to be a problem of multiple instances. I had tried to add "exit" after each command. But it seems it is not something can be done with the current plugin.
Hope you can find a way around it. It is a very useful plugin. Cheers.
The "exit" command is actually always executed already at the end of each command so to gracefully close the connection. I'll do my best! thanks
 
Last edited:

Humpie

Recognized Developer
Dec 23, 2010
1,370
337
103
jolanrensen.nl
Okay finally after converting the project to Gradle and making it work again, I made it open source on GitHub: https://github.com/Jolanrensen/ADBPlugin
The version on there I call 5.0 since it's a rebuilt of the app on the play store, but not much is changed (only slightly improved the responses), so I won't publish it yet on the play store. Of course I'm still looking for the bugs and the multiple instance mess, but now you can help and make a pull request if you know how to fix something I don't (again, I'm far from a professional programmer).
Btw I don't seem to be having any problems on my Shield tablet on android 7.0
 
Last edited:

Humpie

Recognized Developer
Dec 23, 2010
1,370
337
103
jolanrensen.nl
Does anyone know when the new version is released? @Humpie
you can check out the debug version for 5.0 at my github. The responses are improved already, so that will result in better logs hopefully (and of course better use of %output() in tasker itself)
I'm eager to see what it looks like for people with the jibberish-response-bug
 
Last edited:

ttydy

Senior Member
Mar 30, 2012
110
9
0
you can check out the debug version for 5.0 at my github. The responses are improved already, so that will result in better logs hopefully (and of course better use of %output() in tasker itself)
I'm eager to see what it looks like for people with the jibberish-response-bug
Repeatedly run several task tasks, display timeout. you must manually stop app(com.adbplugin) for the job.

Edit: It seems that the last command did not exit properly. I'm using version 5.0

logcat:
08-29 21:39:16.869 I/com.ADBPlugin(6132): Loaded existing keypair
08-29 21:39:16.869 I/com.ADBPlugin(6132): Socket connecting at localhost:5555
08-29 21:39:16.886 I/com.ADBPlugin(6132): Socket connected, creating AdbConnection...
08-29 21:39:16.887 D/com.ADBPlugin(6132): Created, ADB connecting...
 
Last edited:

Humpie

Recognized Developer
Dec 23, 2010
1,370
337
103
jolanrensen.nl
Repeatedly run several task tasks, display timeout. you must manually stop app(com.adbplugin) for the job.

Edit: It seems that the last command did not exit properly. I'm using version 5.0

logcat:
08-29 21:39:16.869 I/com.ADBPlugin(6132): Loaded existing keypair
08-29 21:39:16.869 I/com.ADBPlugin(6132): Socket connecting at localhost:5555
08-29 21:39:16.886 I/com.ADBPlugin(6132): Socket connected, creating AdbConnection...
08-29 21:39:16.887 D/com.ADBPlugin(6132): Created, ADB connecting...
Could you check out the latest apk on github? (you need to uninstall the original as it's a debug version)
I changed the exiting of the connection.
(it's still called 5.0 but I did change some things)
 
Last edited:

ttydy

Senior Member
Mar 30, 2012
110
9
0
Could you check out the latest apk on github? (you need to uninstall the original as it's a debug version)
I changed the exiting of the connection.
(it's still called 5.0 but I did change some things)
So far out of the normal. thx.

Edit: The software does not work for LineageOS 14.1. Run "input keyevent POWER" does not respond.
 
Last edited:

finck125

Member
Jun 26, 2014
6
0
0
So far out of the normal. thx.

Edit: The software does not work for LineageOS 14.1. Run "input keyevent POWER" does not respond.
I am running lineage os 14.1 also. So it could be a problem with that rather than Nougat itself. Just tried the new version from the play store and it still doesn't work.
 

ttydy

Senior Member
Mar 30, 2012
110
9
0
do you have the logs?
Logcat:
08-31 09:31:50.044 I/com.ADBPlugin(7522): Loaded existing keypair
08-31 09:31:50.044 I/com.ADBPlugin(7522): Socket connecting at localhost:5555
08-31 09:31:50.047 I/com.ADBPlugin(7522): Socket connected, creating AdbConnection...
08-31 09:31:50.047 D/com.ADBPlugin(7522): Created, ADB connecting...
08-31 09:31:50.056 D/com.ADBPlugin(7522): ADB connected, opening shell stream...
08-31 09:31:50.061 D/com.ADBPlugin(7522): Opened, writing command: input keyevent POWER
08-31 09:31:50.062 D/com.ADBPlugin(7522): Command sent, getting responses
08-31 09:31:50.088 D/com.ADBPlugin(7522): response: input keyevent POWER
08-31 09:31:50.088 D/com.ADBPlugin(7522): ^@78oneplus3:/ $
08-31 09:31:50.089 D/com.ADBPlugin(7522): Sending close command and waiting for stream to close
08-31 09:31:50.089 D/com.ADBPlugin(7522): Stream closed, closing Adb...
08-31 09:31:50.090 D/com.ADBPlugin(7522): ADB Closed
08-31 09:31:50.090 D/com.ADBPlugin(7522): Executed single command
 

Humpie

Recognized Developer
Dec 23, 2010
1,370
337
103
jolanrensen.nl
Logcat:
08-31 09:31:50.044 I/com.ADBPlugin(7522): Loaded existing keypair
08-31 09:31:50.044 I/com.ADBPlugin(7522): Socket connecting at localhost:5555
08-31 09:31:50.047 I/com.ADBPlugin(7522): Socket connected, creating AdbConnection...
08-31 09:31:50.047 D/com.ADBPlugin(7522): Created, ADB connecting...
08-31 09:31:50.056 D/com.ADBPlugin(7522): ADB connected, opening shell stream...
08-31 09:31:50.061 D/com.ADBPlugin(7522): Opened, writing command: input keyevent POWER
08-31 09:31:50.062 D/com.ADBPlugin(7522): Command sent, getting responses
08-31 09:31:50.088 D/com.ADBPlugin(7522): response: input keyevent POWER
08-31 09:31:50.088 D/com.ADBPlugin(7522): ^@ 7 [r [999;999H [6n 8oneplus3:/ $
08-31 09:31:50.089 D/com.ADBPlugin(7522): Sending close command and waiting for stream to close
08-31 09:31:50.089 D/com.ADBPlugin(7522): Stream closed, closing Adb...
08-31 09:31:50.090 D/com.ADBPlugin(7522): ADB Closed
08-31 09:31:50.090 D/com.ADBPlugin(7522): Executed single command
Thanks! It seems there's something special in the way the shell works on lineage Os, perhaps a different encoding or something... I wonder why they changed it from aosp though... I'll try to find out what this difference is.
Edit: I actually have an old tablet running cyanogenmod and it seems to have the same problem as you have! I'll see what I can do to fix it
Status update: ADB on these devices is a mess. I have to verify every time if the plugin is actually writing its command on the receiving device and the receiving device is actually responsive, but still trying!
 
Last edited:

ttydy

Senior Member
Mar 30, 2012
110
9
0
Thanks! It seems there's something special in the way the shell works on lineage Os, perhaps a different encoding or something... I wonder why they changed it from aosp though... I'll try to find out what this difference is.
Edit: I actually have an old tablet running cyanogenmod and it seems to have the same problem as you have! I'll see what I can do to fix it
Looking forward to your solution.
 

ttydy

Senior Member
Mar 30, 2012
110
9
0
Thanks! It seems there's something special in the way the shell works on lineage Os, perhaps a different encoding or something... I wonder why they changed it from aosp though... I'll try to find out what this difference is.
Edit: I actually have an old tablet running cyanogenmod and it seems to have the same problem as you have! I'll see what I can do to fix it
Status update: ADB on these devices is a mess. I have to verify every time if the plugin is actually writing its command on the receiving device and the receiving device is actually responsive, but still trying!
The result of the loop is not right, see the attachment. The correct result you can use the last command alone.

Edit: It seems to get the output of the previous one.
 

Attachments

Last edited:

Humpie

Recognized Developer
Dec 23, 2010
1,370
337
103
jolanrensen.nl
I haven't been able to make it work yet on my tablet, as it's adb is fairly inconsistent with the responses. However, I'm not sure anymore if it acts the same way as with your phone. It seems my tablet ends some lines with a unknown character which messes up the ability to type the command... I'll have to find another (newer) cyanogenmod/lineage device to test with
 

ttydy

Senior Member
Mar 30, 2012
110
9
0
I haven't been able to make it work yet on my tablet, as it's adb is fairly inconsistent with the responses. However, I'm not sure anymore if it acts the same way as with your phone. It seems my tablet ends some lines with a unknown character which messes up the ability to type the command... I'll have to find another (newer) cyanogenmod/lineage device to test with
I installed the LOS system. You can send me.
 

ttydy

Senior Member
Mar 30, 2012
110
9
0
I haven't been able to make it work yet on my tablet, as it's adb is fairly inconsistent with the responses. However, I'm not sure anymore if it acts the same way as with your phone. It seems my tablet ends some lines with a unknown character which messes up the ability to type the command... I'll have to find another (newer) cyanogenmod/lineage device to test with
Re-explain, I get an error the result is not on the LOS, but OnePlus3 OOS. LOS get no results.
 

Humpie

Recognized Developer
Dec 23, 2010
1,370
337
103
jolanrensen.nl
Re-explain, I get an error the result is not on the LOS, but OnePlus3 OOS. LOS get no results.
You can see what happens with that other adb app I linked here before. If you try to connect with adb to such a device you can't immediately type the command. You'll need to send an Enter before you can start to type. This seems pretty consider with all LOS/CM devices. However the CM device I own also has another problem (something with line endings or) so I can't test if I fixed the first problem with that device.
I do have a 3t with oos, however no problems there, it works fine.
 
Last edited:

ttydy

Senior Member
Mar 30, 2012
110
9
0
You can see what happens with that other adb app I linked here before. If you try to connect with adb to such a device you can't immediately type the command. You'll need to send an Enter before you can start to type. This seems pretty consider with all LOS/CM devices. However the CM device I own also has another problem (something with line endings or) so I can't test if I fixed the first problem with that device.
I do have a 3t with oos, however no problems there, it works fine.
When a single command, the result is correct, the loop is wrong. I made the last tasker xml the last one to "dumpsysy audio" results are correct. Loop as if the next number of characters to obtain less or empty, the result will be on a result.

Edit: other adb app (remote ADB shell) in the LOS system also get no results, show garbled. @Humpie
 
Last edited:
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone