mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
AndroidTarget: Change screen resolution acquisition method
The current regexp doesn't seem to work anymore on a more recent Android version (current master which reports 'Q'). Looking at other means of getting the screen resolution, this one: [1] seems to have been there for some time already (2014), and works with the current version. [1]: https://stackoverflow.com/a/26185910/5096023
This commit is contained in:
parent
bf1310c278
commit
809d987f84
@ -43,8 +43,7 @@ from devlib.utils.types import integer, boolean, bitmask, identifier, caseless_s
|
|||||||
FSTAB_ENTRY_REGEX = re.compile(r'(\S+) on (.+) type (\S+) \((\S+)\)')
|
FSTAB_ENTRY_REGEX = re.compile(r'(\S+) on (.+) type (\S+) \((\S+)\)')
|
||||||
ANDROID_SCREEN_STATE_REGEX = re.compile('(?:mPowerState|mScreenOn|Display Power: state)=([0-9]+|true|false|ON|OFF)',
|
ANDROID_SCREEN_STATE_REGEX = re.compile('(?:mPowerState|mScreenOn|Display Power: state)=([0-9]+|true|false|ON|OFF)',
|
||||||
re.IGNORECASE)
|
re.IGNORECASE)
|
||||||
ANDROID_SCREEN_RESOLUTION_REGEX = re.compile(r'mUnrestrictedScreen=\(\d+,\d+\)'
|
ANDROID_SCREEN_RESOLUTION_REGEX = re.compile(r'cur=(?P<width>\d+)x(?P<height>\d+)')
|
||||||
r'\s+(?P<width>\d+)x(?P<height>\d+)')
|
|
||||||
DEFAULT_SHELL_PROMPT = re.compile(r'^.*(shell|root|juno)@?.*:[/~]\S* *[#$] ',
|
DEFAULT_SHELL_PROMPT = re.compile(r'^.*(shell|root|juno)@?.*:[/~]\S* *[#$] ',
|
||||||
re.MULTILINE)
|
re.MULTILINE)
|
||||||
KVERSION_REGEX = re.compile(
|
KVERSION_REGEX = re.compile(
|
||||||
@ -1042,7 +1041,7 @@ class AndroidTarget(Target):
|
|||||||
@property
|
@property
|
||||||
@memoized
|
@memoized
|
||||||
def screen_resolution(self):
|
def screen_resolution(self):
|
||||||
output = self.execute('dumpsys window')
|
output = self.execute('dumpsys window displays')
|
||||||
match = ANDROID_SCREEN_RESOLUTION_REGEX.search(output)
|
match = ANDROID_SCREEN_RESOLUTION_REGEX.search(output)
|
||||||
if match:
|
if match:
|
||||||
return (int(match.group('width')),
|
return (int(match.group('width')),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user