mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
AndroidTarget: Utilise the adb root functionality of the connection
Adb specific functionality does not belong in the target however for now rely on the connection to perform (un)rooting of the connection.
This commit is contained in:
parent
5601fdb108
commit
9982f810e1
@ -1503,14 +1503,11 @@ class AndroidTarget(Target):
|
||||
adb_command(self.adb_name, 'reboot-bootloader', timeout)
|
||||
|
||||
def adb_root(self, enable=True, force=False):
|
||||
if enable:
|
||||
if self._connected_as_root and not force:
|
||||
if not isinstance(self.conn, AdbConnection):
|
||||
raise TargetStableError('Cannot enable adb root without adb connection')
|
||||
if enable and self.connected_as_root and not force:
|
||||
return
|
||||
adb_command(self.adb_name, 'root', timeout=30)
|
||||
self._connected_as_root = True
|
||||
return
|
||||
adb_command(self.adb_name, 'unroot', timeout=30)
|
||||
self._connected_as_root = False
|
||||
self.conn.adb_root(self.adb_name, enable=enable)
|
||||
|
||||
def is_screen_on(self):
|
||||
output = self.execute('dumpsys power')
|
||||
|
Loading…
x
Reference in New Issue
Block a user