fix(settings): preserve quick resume timeout preference (#2101)

## Summary

### **What is the goal of this PR?**
This fixes an unintended settings side effect when cycling the `Sleep
Screen` option through `Quick Resume`.

Previously, selecting `Sleep Screen = Quick Resume` globally forced
`Quick Resume on Timeout = ON` and left it enabled even after the user
toggled `Sleep Screen` to another option within the same settings
session. Now the auto-enable behavior is scoped to the Settings screen
session:

- If `Quick Resume on Timeout` was already `ON` when entering Settings,
it stays `ON`.
- If it was `OFF`, selecting `Sleep Screen = Quick Resume` temporarily
turns it `ON`.
- If the user then switches away from `Quick Resume`, it turns back
`OFF`.

### **What changes are included?**

- Removes the global logic that permanently forced `Quick Resume on
Timeout` to `ON` whenever `Sleep Screen` was set to `Quick Resume`, even
if it was just due to toggling through the options.
- Adds Settings-screen session tracking so `Quick Resume on Timeout` is
only auto-enabled while the user has `Sleep Screen = Quick Resume`.
- Restores `Quick Resume on Timeout` back to `OFF` when the user
switches away, but only if it was `OFF` when they entered Settings.
- Preserves existing `ON` timeout preferences.
- Same behavior applies to the web settings

## Additional Context

- Tested this on device and via the settings UI
---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it helps set the right
context for reviewers.

Did you use AI tools to help write this code? _**< YES  >**_
This commit is contained in:
Julia
2026-05-21 21:06:51 -04:00
committed by GitHub
parent 2dd491b62e
commit f39ba7037f
7 changed files with 138 additions and 17 deletions
+30 -1
View File
@@ -86,6 +86,10 @@ void SettingsActivity::onEnter() {
// Reset selection to first category
selectedCategoryIndex = 0;
selectedSettingIndex = 0;
preserveQuickResumeTimeoutOn =
SETTINGS.quickResumeSleepScreen == CrossPointSettings::QUICK_RESUME_SLEEP_SCREEN::QUICK_RESUME_AFTER_TIMEOUT;
quickResumeTimeoutAutoEnabled = false;
syncQuickResumeTimeoutForSleepScreen(/*sleepScreenChanged=*/true, /*quickResumeTimeoutChanged=*/false);
rebuildSettingsLists();
@@ -176,6 +180,8 @@ void SettingsActivity::toggleCurrentSetting() {
}
const auto& setting = (*currentSettings)[selectedSetting];
const bool sleepScreenChanged = setting.valuePtr == &CrossPointSettings::sleepScreen;
const bool quickResumeTimeoutChanged = setting.valuePtr == &CrossPointSettings::quickResumeSleepScreen;
if (setting.type == SettingType::TOGGLE && setting.valuePtr != nullptr) {
// Toggle the boolean value using the member pointer
@@ -253,10 +259,33 @@ void SettingsActivity::toggleCurrentSetting() {
return;
}
CrossPointSettings::normalizeDependentSettings(SETTINGS);
syncQuickResumeTimeoutForSleepScreen(sleepScreenChanged, quickResumeTimeoutChanged);
SETTINGS.saveToFile();
}
void SettingsActivity::syncQuickResumeTimeoutForSleepScreen(bool sleepScreenChanged, bool quickResumeTimeoutChanged) {
if (quickResumeTimeoutChanged) {
preserveQuickResumeTimeoutOn =
SETTINGS.quickResumeSleepScreen == CrossPointSettings::QUICK_RESUME_SLEEP_SCREEN::QUICK_RESUME_AFTER_TIMEOUT;
quickResumeTimeoutAutoEnabled = false;
}
if (SETTINGS.sleepScreen == CrossPointSettings::SLEEP_SCREEN_MODE::QUICK_RESUME) {
if (SETTINGS.quickResumeSleepScreen != CrossPointSettings::QUICK_RESUME_SLEEP_SCREEN::QUICK_RESUME_AFTER_TIMEOUT) {
SETTINGS.quickResumeSleepScreen = CrossPointSettings::QUICK_RESUME_SLEEP_SCREEN::QUICK_RESUME_AFTER_TIMEOUT;
quickResumeTimeoutAutoEnabled = !preserveQuickResumeTimeoutOn;
} else if (sleepScreenChanged && !preserveQuickResumeTimeoutOn) {
quickResumeTimeoutAutoEnabled = true;
}
return;
}
if (sleepScreenChanged && quickResumeTimeoutAutoEnabled && !preserveQuickResumeTimeoutOn) {
SETTINGS.quickResumeSleepScreen = CrossPointSettings::QUICK_RESUME_SLEEP_SCREEN::QUICK_RESUME_NEVER;
quickResumeTimeoutAutoEnabled = false;
}
}
void SettingsActivity::render(RenderLock&&) {
renderer.clearScreen();