Commit 439e32a
committed
fix: skip screen off if already in dpms off state
1. Add a check at the beginning of the systemTurnOffScreen function to
skip processing if the display is already in a DPMS off state
2. Introduce a new isDpmsOff helper function to read the state from /
tmp/dpms-state and determine if the screen is already off
3. Adjust the ordering of suspend state constants for logical
consistency, moving suspendStateLidClose before suspendStateFinish
Log: Optimized power button logic to avoid redundant screen-off commands
Influence:
1. Test pressing the power button when the screen is already off via
DPMS; verify the screen state does not change and no redundant actions
occur
2. Test pressing the power button when the screen is on; verify the
screen turns off correctly
3. Test the behavior after waking the system from suspend (lid open);
ensure the screen state is correctly reported and handled
4. Verify that the /tmp/dpms-state file is created and updated correctly
on screen state changes
5. Test the interaction between the power button and other screen off
mechanisms (like idle timeout) to ensure no conflicts
fix: 如果屏幕已处于DPMS关闭状态则跳过屏幕关闭处理
1. 在systemTurnOffScreen函数开头添加检查,如果显示器已处于DPMS off状态则
跳过处理
2. 新增isDpmsOff辅助函数,通过读取/tmp/dpms-state文件来判断屏幕是否已
关闭
3. 调整挂起状态常量的顺序以保持逻辑一致性,将suspendStateLidClose移到
suspendStateFinish之前
Log: 优化电源键逻辑,避免重复发送屏幕关闭命令
Influence:
1. 测试在屏幕已通过DPMS关闭时按下电源键,验证屏幕状态不会改变且没有多余
操作
2. 测试在屏幕开启时按下电源键,验证屏幕能正确关闭
3. 测试从挂起状态唤醒(开盖)后的行为,确保屏幕状态能正确报告和处理
4. 验证/tmp/dpms-state文件在屏幕状态变化时能被正确创建和更新
5. 测试电源键与其他屏幕关闭机制(如空闲超时)的交互,确保没有冲突
PMS: BUG-3648351 parent 40b43f9 commit 439e32a
4 files changed
Lines changed: 88 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | | - | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
287 | 288 | | |
288 | 289 | | |
289 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
290 | 294 | | |
291 | 295 | | |
292 | 296 | | |
| |||
327 | 331 | | |
328 | 332 | | |
329 | 333 | | |
330 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
331 | 344 | | |
332 | 345 | | |
333 | 346 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
1059 | 1061 | | |
1060 | 1062 | | |
1061 | 1063 | | |
1062 | | - | |
| 1064 | + | |
1063 | 1065 | | |
1064 | 1066 | | |
1065 | 1067 | | |
1066 | 1068 | | |
1067 | 1069 | | |
1068 | | - | |
| 1070 | + | |
1069 | 1071 | | |
1070 | | - | |
| 1072 | + | |
1071 | 1073 | | |
1072 | 1074 | | |
1073 | 1075 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
| 213 | + | |
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| |||
0 commit comments