1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

target: Handle dozing case in checking Android screen state

is_screen_on() should also check if the screen is in 'Dozing' state. If
the device is dozing, then is_screen_on() should return false.

Without this patch, is_screen_on() throws 'Could not establish screen
state' exception if the device is idling (screen is completely off).

Signed-off-by: Metin Kaya <metin.kaya@arm.com>
This commit is contained in:
Metin Kaya 2024-01-05 12:08:58 +00:00 committed by Marc Bonnici
parent 2f48b84e6b
commit 07294251c8

View File

@ -68,7 +68,7 @@ import devlib.utils.asyn as asyn
FSTAB_ENTRY_REGEX = re.compile(r'(\S+) on (.+) type (\S+) \((\S+)\)')
ANDROID_SCREEN_STATE_REGEX = re.compile('(?:mPowerState|mScreenOn|mWakefulness|Display Power: state)=([0-9]+|true|false|ON|OFF|DOZE|Asleep|Awake)',
ANDROID_SCREEN_STATE_REGEX = re.compile('(?:mPowerState|mScreenOn|mWakefulness|Display Power: state)=([0-9]+|true|false|ON|OFF|DOZE|Dozing|Asleep|Awake)',
re.IGNORECASE)
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])')
@ -2220,6 +2220,8 @@ class AndroidTarget(Target):
if match:
if 'DOZE' in match.group(1).upper():
return True
if match.group(1) == 'Dozing':
return False
if match.group(1) == 'Asleep':
return False
if match.group(1) == 'Awake':