1
0
mirror of https://github.com/ARM-software/devlib.git synced 2024-10-06 02:40:50 +01: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:
Marc Bonnici 2019-08-27 14:43:54 +01:00
parent 5601fdb108
commit 9982f810e1

View File

@ -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')