mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
target: Add helper function to check Android screen's locking state
Introduce is_screen_locked() which returns true if device screen is locked and false otherwise. This will be useful to automate unlocking the screen [1]. Also fix a typo in is_screen_on()'s documentation. [1] https://github.com/ARM-software/workload-automation/pull/1246 Signed-off-by: Metin Kaya <metin.kaya@arm.com>
This commit is contained in:
parent
07294251c8
commit
14b4e2069b
@ -2213,6 +2213,11 @@ class AndroidTarget(Target):
|
||||
def reboot_bootloader(self, timeout=30):
|
||||
self.conn.reboot_bootloader()
|
||||
|
||||
@asyn.asyncf
|
||||
async def is_screen_locked(self):
|
||||
screen_state = await self.execute.asyn('dumpsys window')
|
||||
return 'mDreamingLockscreen=true' in screen_state
|
||||
|
||||
@asyn.asyncf
|
||||
async def is_screen_on(self):
|
||||
output = await self.execute.asyn('dumpsys power')
|
||||
|
@ -747,10 +747,15 @@ Android Target
|
||||
|
||||
.. method:: AndroidTarget.is_screen_on()
|
||||
|
||||
Returns ``True`` if the targets screen is currently on and ``False``
|
||||
Returns ``True`` if the target's screen is currently on and ``False``
|
||||
otherwise. If the display is in a "Doze" mode or similar always on state,
|
||||
this will return ``True``.
|
||||
|
||||
.. method:: AndroidTarget.is_screen_locked()
|
||||
|
||||
Returns ``True`` if the target's screen is currently locked and ``False``
|
||||
otherwise.
|
||||
|
||||
.. method:: AndroidTarget.wait_for_device(timeout=30)
|
||||
|
||||
Returns when the devices becomes available withing the given timeout
|
||||
|
Loading…
x
Reference in New Issue
Block a user