mirror of
https://github.com/ARM-software/devlib.git
synced 2025-02-07 13:40:48 +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)
|
adb_command(self.adb_name, 'reboot-bootloader', timeout)
|
||||||
|
|
||||||
def adb_root(self, enable=True, force=False):
|
def adb_root(self, enable=True, force=False):
|
||||||
if enable:
|
if not isinstance(self.conn, AdbConnection):
|
||||||
if self._connected_as_root and not force:
|
raise TargetStableError('Cannot enable adb root without adb connection')
|
||||||
|
if enable and self.connected_as_root and not force:
|
||||||
return
|
return
|
||||||
adb_command(self.adb_name, 'root', timeout=30)
|
self.conn.adb_root(self.adb_name, enable=enable)
|
||||||
self._connected_as_root = True
|
|
||||||
return
|
|
||||||
adb_command(self.adb_name, 'unroot', timeout=30)
|
|
||||||
self._connected_as_root = False
|
|
||||||
|
|
||||||
def is_screen_on(self):
|
def is_screen_on(self):
|
||||||
output = self.execute('dumpsys power')
|
output = self.execute('dumpsys power')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user