Skip to content

Instantly share code, notes, and snippets.

@avoidik
Forked from kairusds/1-termux-adb.md
Last active September 22, 2024 08:33
Show Gist options
  • Save avoidik/94aa216d2777da0a878e24de0186c534 to your computer and use it in GitHub Desktop.
Save avoidik/94aa216d2777da0a878e24de0186c534 to your computer and use it in GitHub Desktop.
Instructions for connecting Termux's android-tools adb to the current device via Wireless debugging and fixing phantom process killing

Install android-tools if you haven't already:

$ pkg update ; pkg upgrade
$ pkg install android-tools

Pair with remote or local ADB

$ adb pair ipaddr:port pin-code

Where ipaddr:port and pin-code are taken from the menu shown when clicked from Developer options > Wireless debugging > Pair device with pairing code. You may use localhost when connecting to the same device. Pay attention to port, the one for pairing differs from another one used for typical ADB communication.

Use splitscreen to show the Wireless debugging setting side by side with the Termux app when pairing.

After pairing successfully, run the following commands to either connect or disconnect:

$ adb connect ipaddr:port
$ adb disconnect

Where ipaddr:port is shown in the Wireless debugging menu as IP address & Port. You may use localhost when connecting to the same device.

After Termux has connected via Wireless debugging, run the command below to fix phantom process killing (it only works on Android 12L and above)

$ adb shell "settings get global settings_enable_monitor_phantom_procs"
$ adb shell "settings put global settings_enable_monitor_phantom_procs false"
@avoidik
Copy link
Author

avoidik commented Sep 22, 2024

$ adb shell "/system/bin/dumpsys activity settings | grep max_phantom_processes"
  max_phantom_processes=32
$ adb shell "/system/bin/device_config put activity_manager max_phantom_processes 2147483647”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment