Repository navigation
Verify adb root took effect and add skip_root option - #1066
Open
xpconanfan wants to merge 1 commit into
Open
xpconanfan wants to merge 1 commit into
xpconanfan wants to merge 1 commit into
Conversation
xpconanfan
force-pushed
the
root_on_init
branch
from
October 9, 2026 21:38
71499f5 to
57ed449
Compare
xpconanfan
commented
Oct 12, 2026
|
|
||
| def _root_adb_on_init(self): | ||
| """Runs `adb root` on rootable builds according to `root_on_init`.""" | ||
| if self.root_on_init == ROOT_ON_INIT_NEVER or not self.is_rootable: |
Collaborator
Author
There was a problem hiding this comment.
there should be a debug/verbose log here so we know what happened
Collaborator
Author
There was a problem hiding this comment.
Added debug logs when skipping automatic adb root (both when root_on_init is "never" and when the build is not rootable), and moved _root_adb_on_init() out of AndroidDevice.__init__ into get_instances / get_instances_with_configs (with root_on_init as a validated settable property loaded via load_config).
xpconanfan
force-pushed
the
root_on_init
branch
2 times, most recently
from
October 12, 2026 20:48
449781a to
99233bf
Compare
adb root failures and add root_on_init optionadb root took effect and add skip_root option
xpconanfan
force-pushed
the
root_on_init
branch
from
October 23, 2026 03:43
99233bf to
1181d65
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
adb rootexits 0 even when adbd refuses to restart as root (e.g. "adbd cannot run as root in production builds"; the exact message varies across OEMs), so Mobly's automaticadb rooton debuggable builds could fail without any indication. Separately, there was no way to opt out of automatic rooting, which matters for tests that must behave identically on user and userdebug builds (e.g. CTS).This PR:
AndroidDevice.root_adb()now verifies the outcome viais_adb_root(id -u == 0) afteradb root, logs a warning if it did not take effect, and returns a bool. No new exception path, so devices that reportro.debuggable=1but refuse root keep working as before, just no longer silently.skip_rootoption (constructor kwarg +skip_rootcontroller config key, mirroringskip_logcat) that disables automaticadb rootat creation time and afterhandle_reboot. Explicitroot_adb()calls are unaffected.Automatic rooting still happens in
__init__, so code that constructsAndroidDevice(serial)directly keeps its current behavior.Fixes b/419425573 (internal).