Skip to content

Commit 4e90588

Browse files
bkonyigemini-code-assist[bot]
authored andcommitted
[ Device Lab ] Fix wakefulness check to only match log entries with string values (flutter#174953)
Sometimes there can be multiple wakefulness log entries (e.g., 'mWakefulness=Awake' and 'mWakefulness=1'), but we only care about the entry with a string value. --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent bb7aeeb commit 4e90588

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

dev/devicelab/lib/framework/devices.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ class AndroidDevice extends Device {
685685
final String powerInfo = await shellEval('dumpsys', <String>['power']);
686686
// A motoG4 phone returns `mWakefulness=Awake`.
687687
// A Samsung phone returns `getWakefullnessLocked()=Awake`.
688-
final RegExp wakefulnessRegexp = RegExp(r'.*(mWakefulness=|getWakefulnessLocked\(\)=).*');
688+
final RegExp wakefulnessRegexp = RegExp(r'(?:mWakefulness|getWakefulnessLocked\(\))=[a-zA-Z]+');
689689
final String wakefulness = grep(wakefulnessRegexp, from: powerInfo).single.split('=')[1].trim();
690690
return wakefulness;
691691
}

0 commit comments

Comments
 (0)