Skip to content

Commit 4807330

Browse files
committed
dtmilano#128: Extra alternative to obtain orientation
1 parent 8681234 commit 4807330

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

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

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

20-
__version__ = '9.2.1'
20+
__version__ = '9.2.2'
2121

2222
import sys
2323
import warnings
@@ -481,6 +481,13 @@ def __getDisplayOrientation(self, key, strip=True):
481481
displayInfo = self.getDisplayInfo()
482482
if 'orientation' in displayInfo:
483483
return displayInfo['orientation']
484+
# Fallback method to obtain the orientation
485+
# See https://github.com/dtmilano/AndroidViewClient/issues/128
486+
surfaceOrientationRE = re.compile('SurfaceOrientation:\s+(\d+)')
487+
output = self.shell('dumpsys input')
488+
m = surfaceOrientationRE.search(output)
489+
if m:
490+
return int(m.group(1))
484491
# We couldn't obtain the orientation
485492
return -1
486493

0 commit comments

Comments
 (0)