Skip to content

Commit 1d04fa2

Browse files
committed
getRestrictedScreen support android-2.3.5 version
1 parent 6f8f503 commit 1d04fa2

2 files changed

Lines changed: 9 additions & 2 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='7.1.1',
6+
version='7.1.2',
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: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,18 @@ def shell(self, cmd=None):
285285
def getRestrictedScreen(self):
286286
''' Gets C{mRestrictedScreen} values from dumpsys. This is a method to obtain display dimensions '''
287287

288+
outlines = self.shell('dumpsys window').splitlines()
288289
rsRE = re.compile('\s*mRestrictedScreen=\((?P<x>\d+),(?P<y>\d+)\) (?P<w>\d+)x(?P<h>\d+)')
289-
for line in self.shell('dumpsys window').splitlines():
290+
for line in outlines:
290291
m = rsRE.match(line)
291292
if m:
292293
return m.groups()
294+
# in order to competiable with android-2.3.5
295+
dsRE = re.compile('\s*DisplayWidth=(?P<x>\d+) DisplayHeight=(?P<y>\d+)')
296+
for line in outlines:
297+
m = dsRE.match(line)
298+
if m:
299+
return ('0', '0') + m.groups()
293300
raise RuntimeError("Couldn't find mRestrictedScreen in dumpsys")
294301

295302
def __getProp(self, key, strip=True):

0 commit comments

Comments
 (0)