Redraw every open copy of the launcher when a setting changes

Opening the launcher like an app (the installer's "Open") and then making it
the home app leaves two launcher activities in one process. A changed setting
recreated whichever one LawnchairApp.launcher returned, which could be the one
in the background, so the home screen kept its old look until a restart.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
TMCandClaude Fable 5.2 committed 2026-11-12 13:04:33 +01:00
1 parent 8cfa2fdc84
commit d5a62cc6f5
2 files changed
+16 -1

No files matched your search

@@ -214,6 +214,10 @@ class LawnchairApp : LauncherApplication() {
val launcher: LawnchairLauncher?
get() = activities.filterIsInstance<LawnchairLauncher>().firstOrNull()
// Flexera Launcher: see LawnchairApp.launchers.
val launchers: List<LawnchairLauncher>
get() = activities.filterIsInstance<LawnchairLauncher>()
fun finishAll() {
HashSet(activities).forEach { it.finish() }
}
@@ -292,6 +296,14 @@ class LawnchairApp : LauncherApplication() {
@JvmStatic
val launcher: LawnchairLauncher? get() = instance.activityHandler.launcher
/**
* Flexera Launcher: every copy of the launcher that is open. There are two when it was
* opened like an app (from the installer's "Open", say) and then made the home app: one
* in the app's own task and one as the home screen. [launcher] picks either of them.
*/
@JvmStatic
val launchers: List<LawnchairLauncher> get() = instance.activityHandler.launchers
@OptIn(ExperimentalMaterial3ExpressiveApi::class, ExperimentalMaterial3Api::class)
fun Launcher.showQuickstepWarningIfNecessary() {
val launcher = this
@@ -517,7 +517,10 @@ class LawnchairLauncher : QuickstepLauncher() {
fun recreateIfNotScheduled() {
if (sRestartFlags == 0) {
recreate()
// Flexera Launcher: every open copy, not only this one. A changed setting used to
// rebuild whichever copy LawnchairApp.launcher happened to return, which could be
// the one in the background, and the home screen kept its old look until restart.
(LawnchairApp.launchers + this).distinct().forEach { it.recreate() }
}
}