Handle density configuration changes to prevent unnecessary app restarts (#1828)

## Description
Add `density` to `configChanges` and handle any changes to density that
occur. Thankfully, Compose handles density changes itself, so only
changes where a density calculation is "remembered" needed to be
updated.

Without this, some devices will recreate `MainActivity` when switching
resolutions for playback. That recreation would cause playback to end
immediately.

### Related issues
Fixes #1809

### Testing
Tested on Onn 4k Pro & nvidia shield

I was able to reproduce on the Onn, but not the Shield, so this might be
device and/or API level specific

## Screenshots
N/A

## AI or LLM usage
None
This commit is contained in:
Damontecres 2026-08-12 21:01:28 -04:00 • committed by GitHub
parent e6304f79a2
commit 54966f9124
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 31 additions and 12 deletions

View file

@ -380,7 +380,7 @@ class MainActivity : AppCompatActivity() {
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
Timber.d("onConfigurationChanged")
Timber.d("onConfigurationChanged: newConfig=%s", newConfig)
}
override fun onNewIntent(intent: Intent) {