mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-20 02:04:01 -04:00
fix(power): reconcile refresh rate after resume (#3459)
This commit is contained in:
@@ -14,6 +14,8 @@ Singleton {
|
||||
readonly property int batteryRefreshRateTarget: 60000
|
||||
readonly property int batteryRefreshRateTolerance: 1000
|
||||
|
||||
property int powerSyncRecoveryAttempt: 0
|
||||
readonly property var powerSyncRecoveryIntervals: [1000, 5000, 15000, 30000]
|
||||
property var _lastAppliedTargets: ({})
|
||||
|
||||
Timer {
|
||||
@@ -40,6 +42,32 @@ Singleton {
|
||||
onTriggered: root.requestSync("startup")
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: powerSyncRecoveryTimer
|
||||
interval: root.powerSyncRecoveryIntervals[0]
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
root.requestSync("resume-reconcile");
|
||||
root.powerSyncRecoveryAttempt++;
|
||||
if (root.powerSyncRecoveryAttempt < root.powerSyncRecoveryIntervals.length) {
|
||||
interval = root.powerSyncRecoveryIntervals[root.powerSyncRecoveryAttempt];
|
||||
restart();
|
||||
return;
|
||||
}
|
||||
root.powerSyncRecoveryAttempt = 0;
|
||||
interval = root.powerSyncRecoveryIntervals[0];
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: SessionService
|
||||
function onSessionResumed() {
|
||||
root.powerSyncRecoveryAttempt = 0;
|
||||
powerSyncRecoveryTimer.interval = root.powerSyncRecoveryIntervals[0];
|
||||
powerSyncRecoveryTimer.restart();
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: BatteryService
|
||||
function onIsPluggedInChanged() {
|
||||
|
||||
Reference in New Issue
Block a user