Skip to content

Commit 5f63239

Browse files
committed
- Version 5.1.0
1 parent bd90bf6 commit 5f63239

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

AndroidViewClient/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from setuptools import setup, find_packages
44

55
setup(name='androidviewclient',
6-
version='5.0.0',
6+
version='5.1.0',
77
description='''AndroidViewClient is a 100% pure python tool that
88
simplifies test script creation providing higher level operations and the ability of
99
obtaining the tree of Views present at any given moment on the device or emulator screen.

AndroidViewClient/src/com/dtmilano/android/adb/adbclient.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
@author: Diego Torres Milano
1818
'''
1919

20-
__version__ = '5.0.0'
20+
__version__ = '5.1.0'
2121

2222
import sys
2323
import warnings
@@ -391,7 +391,8 @@ def type(self, text):
391391
self.shell(u'input text "%s"' % text)
392392

393393
def wake(self):
394-
self.shell('input keyevent POWER')
394+
if not self.isScreenOn():
395+
self.shell('input keyevent POWER')
395396

396397
def isLocked(self):
397398
'''
@@ -406,6 +407,19 @@ def isLocked(self):
406407
return (m.group(1) == 'true')
407408
raise RuntimeError("Couldn't determine screen lock state")
408409

410+
def isScreenOn(self):
411+
'''
412+
Checks if the screen is ON.
413+
414+
@return True if the device screen is ON
415+
'''
416+
417+
screenOnRE = re.compile('mScreenOnFully=(true|false)')
418+
m = screenOnRE.search(self.shell('dumpsys window policy'))
419+
if m:
420+
return (m.group(1) == 'true')
421+
raise RuntimeError("Couldn't determine screen ON state")
422+
409423
def unlock(self):
410424
'''
411425
Unlocks the screen of the device.

0 commit comments

Comments
 (0)