1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

utils/android: Fix adb_root() exceptions

Ensure adb_root() always raises AdbRootError so that the caller can
catch it reliably. This is especially important since adb_root() failing
is ignored and simply triggers a fallback on using `su`. Android
production builds refuse adb root nowadays, so it's important that adb
root failures are handled well.
This commit is contained in:
Douglas Raillard 2023-02-03 15:08:20 +00:00 committed by Marc Bonnici
parent 4b13ee79eb
commit 0a910071f8

View File

@ -411,11 +411,11 @@ class AdbConnection(ConnectionBase):
if 'adbd is already running as root' in e.output:
pass
else:
raise
raise AdbRootError(str(e)) from e
else:
# Check separately as this does not cause a error exit code.
if 'cannot run as root in production builds' in output:
raise TargetStableError(output)
raise AdbRootError(output)
AdbConnection._connected_as_root[self.device] = enable
def wait_for_device(self, timeout=30):