From 8839ed01bad79fbd110bcd7d47c620c211627d60 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Thu, 10 Aug 2017 17:19:13 +0100 Subject: [PATCH] AndroidTarget: Changes default unlocking method Instead of using a default 'horizontal' unlocking method, now will try a diagonal swipe up as this should work most modern devices with vertical or horizontal unlocking methods. --- devlib/target.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/devlib/target.py b/devlib/target.py index 4892951..b96bbdc 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -1061,10 +1061,15 @@ class AndroidTarget(Target): # Android-specific - def swipe_to_unlock(self, direction="horizontal"): + def swipe_to_unlock(self, direction="diagonal"): width, height = self.screen_resolution command = 'input swipe {} {} {} {}' - if direction == "horizontal": + if direction == "diagonal": + start = 100 + stop = width - start + swipe_height = height * 2 // 3 + self.execute(command.format(start, swipe_height, stop, 0)) + elif direction == "horizontal": swipe_height = height * 2 // 3 start = 100 stop = width - start