ADB over network

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Locked
User avatar
beelze
Posts: 46
Joined: 04 Nov 2018 16:45

ADB over network

Post by beelze » 04 Nov 2018 19:08

Is there (maybe indirect) action for the toggling ADB over network? If not, this is a FR.

I've tried System Setting Changed: <All categories> *, but it triggering only for the ADB option itself, but not for the ADB over network.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: ADB over network

Post by Desmanto » 05 Nov 2018 05:40

No need for additional feature, this is niche function, can be done via root command. You must have root to toggle the adb over wifi. You can do it without root via adb over USB debugging, but it will be reset on every restart. Since you are using AICP, I assume you have root already. Simply use Execute root command :

Code: Select all

setprop service.adb.tcp.port 5555
stop adbd
start adbd
After you paste the command, it seems there is no newline, but no problem, it is just the visual. Execute it, it will turn on the adb over wifi. To connect to your phone, use

Code: Select all

adb connect 192.168.1.100
replace the IP with the IP of your phone

After you have finished, to reduce security risk, you can turn off the adb over wifi again. Use the same execute root command, simply set the port to -1

Code: Select all

setprop service.adb.tcp.port -1
stop adbd
start adbd
This will disable adb over wifi and return back to adb over usb mode.

You can create it in toggle mode by using shortcut and switch over each mode. Or you can simply control it using Trigger HTTP request, just like what I have been using it for.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
beelze
Posts: 46
Joined: 04 Nov 2018 16:45

Re: ADB over network

Post by beelze » 05 Nov 2018 09:10

Thanks, Desmanto.
I've already tried this method from a terminal and it worked, but there is one minor issue – corresponding UI toggle not switching (at least on my device). Not a real problem, but inaccurate. Though if there is no another way...

User avatar
beelze
Posts: 46
Joined: 04 Nov 2018 16:45

Re: ADB over network

Post by beelze » 05 Nov 2018 10:14

upd:
Another (not so small) problem is that setting port/restarting service not affecting status bar notification. So, there is no way to see actual ADB over network status after playing the service.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: ADB over network

Post by Desmanto » 05 Nov 2018 15:24

Yes, the quick setting seems not synced properly to the current state, after being changed by Automagic. Other quick settings value too, such as some report it is bluetooth. For me it is the language and this adb over wifi.

Sometimes we have no way to really force the system to reread the system value we have changed. As in demo mode, where I can't force the system to enter demo UI mode, I ended up using am broadcast with root, to put it into demo mode.

We can use the built-in quick setting tile and adjust our icon accordingly. So we don't use built-in one from android, but create our own version instead. Of course you have to remove built-in one and add the automagic version. There are 5 tiles you can use. Toggle the icon everytime you change the adb over wifi state.

BTW, I just know AICP is based on LOS too. So you can try to use Set LineageOS system setting to see if there is anything you can change to trigger this. At mine, RR 6.2, change the adb port to 5555 via this action, cause error.
ch.gridvision.ppam.androidautomagiclib.util.m: Root functions must be enabled in the settings or secure settings permission must be granted by adb (see help)
at ch.gridvision.ppam.androidautomagic.model.a.ex$1.a(SourceFile:207)
at ch.gridvision.ppam.androidautomagic.model.a.ex$1.c(SourceFile:157)
at ch.gridvision.ppam.androidautomagiclib.util.ci$1.run(SourceFile:40)
at java.lang.Thread.run(Thread.java:764)
Although I have granted Automagic root access and write LOS permission

Code: Select all

adb shell pm grant ch.gridvision.ppam.androidautomagic lineageos.permission.WRITE_SECURE_SETTINGS
I tried to edit the database using MiXplorer, at /data/user_de/0/org.lineageos.lineagesettings/databases/lineagesettings.db, at the secure db, adb_port to 5555, still doesn't trigger the adb over wifi state. So it seems root command is the only way.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
beelze
Posts: 46
Joined: 04 Nov 2018 16:45

Re: ADB over network

Post by beelze » 05 Nov 2018 18:13

Thanks for a detailed explanation.

Interesting, but I've got different error when trying to set LOS Settings secure/adbPort value:

Code: Select all

ch.gridvision.ppam.androidautomagiclib.util.m: The settings have not been verified yet. Please verify first.
Of course, AM granted root and WRITE_SECURE_SETTINGS.

upd: BTW, what is a proper name for this setting? ADB_PORT, adbPort, adb_port or whatever?
Last edited by beelze on 05 Nov 2018 18:21, edited 1 time in total.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: ADB over network

Post by Desmanto » 05 Nov 2018 18:20

You have to check I have verified the setting everytime you change the value. Or you can disable the warning in the Settings > General > Hide setting confirmation.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
beelze
Posts: 46
Joined: 04 Nov 2018 16:45

Re: ADB over network

Post by beelze » 05 Nov 2018 18:39

Well, I've ended with the same «Root functions must be enabled…». All 3 name variants – the same exception.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: ADB over network

Post by Desmanto » 06 Nov 2018 10:53

So this is considered a bug then. Granting it lineageos permission and root, still can't set the value. But choosing category system, the value set fine. Only secure and global have this error as posted above.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Locked