mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
target: add new methods
Added the following method to targets: - sleep: sleep on target for the specified duration. In some situations, e.g. on simulation platforms, it is important that sleep happens on the target rather than the host. Added the following methods to Android targets: - ensure_screen_is_off: complements the existing ensure_screen_is_on. - homescreen: navigate to home screen.
This commit is contained in:
parent
8b2ac8d29d
commit
69a83d4128
@ -552,6 +552,10 @@ class Target(object):
|
||||
else:
|
||||
raise ValueError('Unknown compression format: {}'.format(ext))
|
||||
|
||||
def sleep(self, duration):
|
||||
timeout = duration + 10
|
||||
self.execute('sleep {}'.format(duration), timeout=timeout)
|
||||
|
||||
# internal methods
|
||||
|
||||
def _execute_util(self, command, timeout=None, check_exit_code=True, as_root=False):
|
||||
@ -1067,6 +1071,13 @@ class AndroidTarget(Target):
|
||||
if not self.is_screen_on():
|
||||
self.execute('input keyevent 26')
|
||||
|
||||
def ensure_screen_is_off(self):
|
||||
if self.is_screen_on():
|
||||
self.execute('input keyevent 26')
|
||||
|
||||
def homescreen(self):
|
||||
self.execute('am start -a android.intent.action.MAIN -c android.intent.category.HOME')
|
||||
|
||||
def _resolve_paths(self):
|
||||
if self.working_directory is None:
|
||||
self.working_directory = '/data/local/tmp/devlib-target'
|
||||
|
Loading…
x
Reference in New Issue
Block a user