mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
Teach the script to understand "dumpsys power" output from newer Android versions.
Newer Android versions do not include any of the attributes that we're currently looking for in the "dumpsys power" output. Instead they have "mWakefulness" which can either be "Asleep" or "Awake". Adjust the regex to look for that attribute as well.
This commit is contained in:
parent
917800ffa6
commit
d6a2ed8247
@ -61,7 +61,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|DOZE)',
|
ANDROID_SCREEN_STATE_REGEX = re.compile('(?:mPowerState|mScreenOn|mWakefulness|Display Power: state)=([0-9]+|true|false|ON|OFF|DOZE|Asleep|Awake)',
|
||||||
re.IGNORECASE)
|
re.IGNORECASE)
|
||||||
ANDROID_SCREEN_RESOLUTION_REGEX = re.compile(r'cur=(?P<width>\d+)x(?P<height>\d+)')
|
ANDROID_SCREEN_RESOLUTION_REGEX = re.compile(r'cur=(?P<width>\d+)x(?P<height>\d+)')
|
||||||
ANDROID_SCREEN_ROTATION_REGEX = re.compile(r'orientation=(?P<rotation>[0-3])')
|
ANDROID_SCREEN_ROTATION_REGEX = re.compile(r'orientation=(?P<rotation>[0-3])')
|
||||||
@ -1792,6 +1792,10 @@ class AndroidTarget(Target):
|
|||||||
if match:
|
if match:
|
||||||
if 'DOZE' in match.group(1).upper():
|
if 'DOZE' in match.group(1).upper():
|
||||||
return True
|
return True
|
||||||
|
if match.group(1) == 'Asleep':
|
||||||
|
return False
|
||||||
|
if match.group(1) == 'Awake':
|
||||||
|
return True
|
||||||
return boolean(match.group(1))
|
return boolean(match.group(1))
|
||||||
else:
|
else:
|
||||||
raise TargetStableError('Could not establish screen state.')
|
raise TargetStableError('Could not establish screen state.')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user