Closed Bug 1148395 Opened 10 years ago Closed 10 years ago

devicemanagerADB.py does not support Android su

Categories

(Testing :: Mozbase, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: bc, Unassigned)

Details

devicemanagerADB.py supports devices which do or can run adbd as root or which have a standard shell-like su which uses the -c argument to specify the command to run. It does not support the Android su command which does not support the -c flag. On engineering or debug Android builds, the su command specifies the user id of the user to run the command under and then lists the command and arguments separately. For example, with the shell-like su, you would do su -c 'ls /data/data/' to execute a command with arguments. With an engineering/debug Android su, you would do su 0 ls /data/data to execute the same command. We can easily simulate the shell-like behavior with the engineering/debug Android su by executing sh as part of the command. For example su 0 sh -c 'ls /data/data' I think if we add a check for su 0 id to _checkForRoot at https://dxr.mozilla.org/mozilla-central/source/testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py#655 and save the string required to invoke su as either "su -c" for shell-like su "su 0 sh -c" for android su Then we can add support for devices which have android versions of su by changing https://dxr.mozilla.org/mozilla-central/source/testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py#115 to use the saved string instead of the currently fixed "su -c"
In my experience, engineering/debug Android builds run adbd as root. Is that not always the case? Is someone trying to copy su from an engineering/debug Android build to a device running a non-engineering/debug Android? (This bug sounds like a good idea to me, I'm just not sure I understand the need.)
Yes, I believe engineering/debug Android builds can run adbd as root, but I'm not sure if they always do it by default. devicemanagerADB supports calling adb root to restart adbd as root though. Production Android aosp builds have su but can't run adbd as root though. I have at least one device like that. I guess what I'm looking for is parity between adb.py, devicemanagerADB.py, devicemanagerSUT.py and SUTAgentAndroid that they transparently support all of the possible cases: * adbd is already running as root * adbd can be restarted running as root in which case we should automatically restart it. * su 0 works * su -c works
The original motivation for this bug, bug 1148423, has been resolved by re-rooting a couple of the Autophone devices. I'm going to wontfix this at least for now.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.