Install android-tools if you haven't already:
pkg update ; pkg upgrade
pkg install android-tools
adb pair 127.0.0.1:port
Where port is taken from the menu shown after clicking from
Developer options > Wireless debugging > Pair device with pairing code. Use splitscreen to show theWireless debuggingsetting below the Termux app when pairing.
After pairing successfully, run the following commands to either connect or disconnect:
adb connect 127.0.0.1:port
adb disconnect
Where port is shown in the
Wireless debuggingmenu asIP address & Port.
After you're done with adb, make sure to close the daemon:
adb kill-server




BEWARE
BEWARE before disabling these process limitations!
It drained my battery badly, whenever some process kept running in the background.
BEWARE even more that Android is intentionally lying to you about which processes run!
E.g. in Termux and when using
adb shell run-as com.termux, I see two different results! Even though it is the same user! And in justadb shell, I see other results again!I even got into situations where clearly
sshdwas running (cause I’m freaking using it!), but it just tells me no process matching “sshd” is running at all, and I cannot kill it!I had to reboot, to get my battery to not drain anymore!
I suspect some severe SElinux and namespace shenenigans.