mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-04 16:01:20 +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:
		
				
					committed by
					
						
						Marc Bonnici
					
				
			
			
				
	
			
			
			
						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+)\)')
 | 
			
		||||
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)
 | 
			
		||||
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])')
 | 
			
		||||
@@ -1792,6 +1792,10 @@ class AndroidTarget(Target):
 | 
			
		||||
        if match:
 | 
			
		||||
            if 'DOZE' in match.group(1).upper():
 | 
			
		||||
                return True
 | 
			
		||||
            if match.group(1) == 'Asleep':
 | 
			
		||||
                return False
 | 
			
		||||
            if match.group(1) == 'Awake':
 | 
			
		||||
                return True
 | 
			
		||||
            return boolean(match.group(1))
 | 
			
		||||
        else:
 | 
			
		||||
            raise TargetStableError('Could not establish screen state.')
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user