Tramp is missing a counter of how many times it tries to "exec env..." It should give up after five times, pausing one second per attempt. Currently (2.4.2) if things don't work out right (reasons not relevant!) it will try,
ASUS_Z012D:/data/data/org.galexander.sshd/files $ 07:36:49.974850 tramp-accept-process-output (1) # Quit: "Quit", "nil" exec env TERM='dumb' INSIDE_^Mxec env TERM='dumb' INSIDE_ <^H^H^H..,EMACS='26.3,tramp:2.4.2' ENV='' HISTFILE=~/.tramp_h^ME_EMACS='26.3,tramp:2.4.2' ENV='' HISTFILE=~/.tramp_h <^H^H^H..,istory PROMPT_COMMAND='' ^M' ENV='' HISTFILE=~/.tramp_history PROMPT_COMMAND='' <^H^H^H..,PS1=\#\$\ PS2='' PS3='' ^Mp_history PROMPT_COMMAND='' PS1=\#\$\ PS2='' PS3='' <^H^H^H..,/system/bin/sh ^M ASUS_Z012D:/data/data/org.galexander.sshd/files $ over one hundred thousand times, locking up emacs and the computer.
