mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
AndroidTarget: Added swipe direction to swipe_to_unlock
swipe_to_unlock can now do either horizontal or vertical swipes to unlock a target
This commit is contained in:
parent
cafeb81b83
commit
880a0bcb7c
@ -788,13 +788,20 @@ class AndroidTarget(Target):
|
||||
|
||||
# Android-specific
|
||||
|
||||
def swipe_to_unlock(self):
|
||||
def swipe_to_unlock(self, direction="horizontal"):
|
||||
width, height = self.screen_resolution
|
||||
command = 'input swipe {} {} {} {}'
|
||||
if direction == "horizontal":
|
||||
swipe_heigh = height * 2 // 3
|
||||
start = 100
|
||||
stop = width - start
|
||||
command = 'input swipe {} {} {} {}'
|
||||
self.execute(command.format(start, swipe_heigh, stop, swipe_heigh))
|
||||
if direction == "vertical":
|
||||
swipe_middle = height / 2
|
||||
swipe_heigh = height * 2 // 3
|
||||
self.execute(command.format(swipe_middle, swipe_heigh, swipe_middle, 0))
|
||||
else:
|
||||
raise DeviceError("Invalid swipe direction: {}".format(self.swipe_to_unlock))
|
||||
|
||||
def getprop(self, prop=None):
|
||||
props = AndroidProperties(self.execute('getprop'))
|
||||
|
Loading…
x
Reference in New Issue
Block a user