Fix some cases when refresh rate switching didn't work/timed out (#901)

## Description
An attempt to fix #769

1. Always fetch the `DisplayManager` when switching refresh rates
2. Use the Activity context instead of Application context

### Related issues
Fixes #769

### Testing
I still haven't reproduced #769 myself, but this change works fine on my
shield + LG C2

## Screenshots
N/A

## AI or LLM usage
None
This commit is contained in:
Ray 2026-02-16 09:04:28 -05:00 committed by GitHub
parent 0276c5f49b
commit dc3c6dc739
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 19 deletions

View file

@ -409,7 +409,7 @@ class MainActivity : AppCompatActivity() {
}
fun changeDisplayMode(modeId: Int) {
lifecycleScope.launch(Dispatchers.Main + ExceptionHandler()) {
lifecycleScope.launch(Dispatchers.Main + ExceptionHandler(autoToast = true)) {
val attrs = window.attributes
if (attrs.preferredDisplayModeId != modeId) {
Timber.d("Switch preferredDisplayModeId to %s", modeId)