Commit e600d43
committed
feat: recover power mode after sleep/shutdown/reboot
When performing shutdown, reboot, hibernate or suspend operations,
switch to performance mode before the operation, and restore the user's
configured power mode upon wake or next startup. This ensures smooth
transitions and optimal performance during these critical operations.
Key changes:
1. Add `setTlpMode()` helper function to set power mode via D-Bus
2. Add `recoverySystemPowerMode()` to restore user's configured power
mode after wake
3. Call `setTlpMode(Performance)` before shutdown, reboot, hibernate,
and suspend
4. Connect to `PrepareForSleep` signal to restore mode after sleep wake
5. On startup, schedule recovery of power mode via timer
Log: Optimized power management behavior during system suspend/
hibernate/reboot/shutdown
Influence:
1. Test shutdown: verify system switches to performance mode before
shutdown
2. Test reboot: verify performance mode is set before reboot
3. Test hibernate: verify performance mode is set before hibernation
4. Test suspend: verify performance mode is set before suspend
5. Test wake from sleep: verify user's original power mode is restored
6. Test startup: verify power mode is restored to user's configuration
7. Test with/without battery: verify low battery mode handling on
battery ≤20%
8. Verify D-Bus communication with org.deepin.dde.Power1 service
9. Test error handling when D-Bus calls fail
feat: 恢复休眠/关机/重启后的电源模式
在执行关机、重启、休眠或挂起操作前,先将系统切换到高性能模式,操作完成后
(唤醒或下次启动)再恢复为用户之前配置的电源模式。这确保了这些关键操作期
间的流畅过渡和最佳性能。
主要变更:
1. 添加 `setTlpMode()` 辅助函数,通过 D-Bus 设置电源模式
2. 添加 `recoverySystemPowerMode()` 恢复用户配置的电源模式
3. 在关机、重启、休眠和挂起前调用 `setTlpMode(Performance)`
4. 连接 `PrepareForSleep` 信号,在睡眠唤醒后恢复模式
5. 在启动时通过定时器调度恢复电源模式
Log: 优化系统挂起/休眠/重启/关机时的电源管理行为
Influence:
1. 测试关机:验证关机前是否切换为高性能模式
2. 测试重启:验证重启前是否设置为高性能模式
3. 测试休眠:验证休眠前是否设置为高性能模式
4. 测试挂起:验证挂起前是否设置为高性能模式
5. 测试从睡眠唤醒:验证是否恢复用户原始电源模式
6. 测试启动:验证电源模式是否恢复为用户配置
7. 测试有/无电池情况:验证电池电量≤20%时的低电量模式处理
8. 验证与 org.deepin.dde.Power1 服务的 D-Bus 通信
9. 测试 D-Bus 调用失败时的错误处理
PMS: TASK-389737
Change-Id: I30122c303b2b61a4912a554ccfb0d75dce3747a11 parent 31f0297 commit e600d43
2 files changed
Lines changed: 89 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
| |||
124 | 129 | | |
125 | 130 | | |
126 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
127 | 140 | | |
128 | 141 | | |
129 | 142 | | |
| |||
404 | 417 | | |
405 | 418 | | |
406 | 419 | | |
| 420 | + | |
407 | 421 | | |
408 | 422 | | |
409 | 423 | | |
| |||
447 | 461 | | |
448 | 462 | | |
449 | 463 | | |
| 464 | + | |
450 | 465 | | |
451 | 466 | | |
452 | 467 | | |
453 | 468 | | |
454 | 469 | | |
| 470 | + | |
455 | 471 | | |
456 | 472 | | |
457 | 473 | | |
| |||
463 | 479 | | |
464 | 480 | | |
465 | 481 | | |
| 482 | + | |
| 483 | + | |
466 | 484 | | |
467 | 485 | | |
468 | 486 | | |
| |||
546 | 564 | | |
547 | 565 | | |
548 | 566 | | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
549 | 571 | | |
550 | 572 | | |
551 | 573 | | |
| |||
860 | 882 | | |
861 | 883 | | |
862 | 884 | | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
863 | 950 | | |
864 | 951 | | |
865 | 952 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
| |||
0 commit comments