devicemanagerADB.py and adb.py both perform checks to see if adbd is running as root, adb.py checks if su supports su -c commandline or if su support su 0 command arguments. Bug 1148395 is about adding support for su 0 to devicemanagerADB. See: https://dxr.mozilla.org/mozilla-central/source/testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py#655 https://dxr.mozilla.org/mozilla-central/source/testing/mozbase/mozdevice/mozdevice/adb.py#550 SUTAgentAndroid should detect the rooted state of the device and if adbd is already running as root, it should not attempt to use su. It should also detect which version of su is installed and use the proper invocation instead of hard coding the use of su -c commandline as in getSuArgs in https://dxr.mozilla.org/mozilla-central/source/build/mobile/sutagent/android/DoCommand.java#3390.
Created attachment 8587384 [details] [diff] [review] bug-1148421-dmSUT-su.patch It appears that unless we use su of some form, the commands issued by the sutagent will be executed with the user id of the sutagent regardless of whether adbd runs as root. I tested a patch which attempts to detect if su -c or su 0 sh -c would work, but none of my devices actually support su 0 exclusively any more and without a sutagent that supports su 0, it actually only matters in the fallback for backwards compatibility in shell(). without patch: https://treeherder.mozilla.org/#/jobs?repo=try&revision=e4c2de544dfc&exclusion_profile=false with patch: https://treeherder.mozilla.org/#/jobs?repo=try&revision=940f1c0ed5e9&exclusion_profile=false I included sample mochitest, robocop, jsreftest and reftest jobs in this to make sure the patch didn't interfere with them. The original motivation for this bug, bug 1148423, has been resolved by re-rooting a couple of the Autophone devices. Without testing on a debug or engineering build, I'm not that motivated to actually check this in.
I'm going to wontfix for now.