fix: dual-screen update prompt survives a bottom-screen tap, home launcher stays out of Recents, Quest panel opens landscape (#1893)

* fix: dual-screen launcher keeps the update prompt on screen and stays out of Recents as home; Quest panel opens landscape

Outside screens the launcher opens (the update prompt, Settings, pickers) now hold the top screen when the bottom screen is touched, so a bottom-screen tap no longer buries the Android install prompt and leaves updates stuck waiting for confirmation (DD-368).

When DroidDeck is the home app its launcher task is excluded from Recents, so it can no longer be swiped closed; a running game session is still listed (DD-377).

The launcher declares a 1024x640 dp default panel size so Meta Quest opens it landscape again after the orientation manifest change in #1606 (DD-360).

* fix: Recents exclusion follows the top DroidDeck activity and only undoes its own change

The launcher task is hidden from Recents only while FrontEndActivity is on top, DroidDeck is home and no session runs; the file manager and a running session show it again, the check repeats when the launcher pauses, and tasks hidden by someone else are left alone.

* fix: Recents ownership survives process death and never claims a task someone else excluded
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-10-31 09:21:49 -04:00
1 parent 85dd8beae1
commit ac132a23e2
7 files changed
+104

No files matched your search

@@ -18,6 +18,7 @@ class App : Application() {
super.onCreate()
com.droiddeck.launcher.ui.Themes.loadGradient(this)
com.droiddeck.launcher.ui.BuildWatermark.install(this)
HomeApp.trackRecents(this)
// Helper processes must not initialize the main USB provider or guest graphics context.
val process = if (android.os.Build.VERSION.SDK_INT >= 28) Application.getProcessName()
else (getSystemService(ACTIVITY_SERVICE) as android.app.ActivityManager)
@@ -1574,6 +1574,22 @@ class FrontEndActivity : ComponentActivity() {
startSession(Intent(this, SessionActivity::class.java).putExtra(SessionActivity.EXTRA_STEAMVR, steamVr), steamSession = true)
}
@Suppress("OVERRIDE_DEPRECATION")
override fun startActivityForResult(intent: Intent, requestCode: Int, options: Bundle?) {
val outside = com.droiddeck.launcher.ui.DualScreenPanel.shownOn >= 0 &&
com.droiddeck.launcher.ui.DualScreenPanel.opensOutside(packageName, intent.component?.packageName ?: intent.`package` ?: intent.resolveActivity(packageManager)?.packageName)
if (outside) {
com.droiddeck.launcher.ui.DualScreenPanel.yieldTo(taskId, true)
window.decorView.postDelayed({ if (hasWindowFocus()) com.droiddeck.launcher.ui.DualScreenPanel.yieldTo(taskId, false) }, 1500)
}
try {
super.startActivityForResult(intent, requestCode, options)
} catch (e: RuntimeException) {
if (outside) com.droiddeck.launcher.ui.DualScreenPanel.yieldTo(taskId, false)
throw e
}
}
override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus)
if (hasFocus) {
@@ -147,6 +147,52 @@ object HomeApp {
.getShortcutIconDrawable(info, context.resources.displayMetrics.densityDpi)?.toBitmap(px, px)
}.getOrNull()
fun trackRecents(app: android.app.Application) {
app.registerActivityLifecycleCallbacks(object : android.app.Application.ActivityLifecycleCallbacks {
override fun onActivityCreated(activity: android.app.Activity, savedInstanceState: android.os.Bundle?) = Unit
override fun onActivityStarted(activity: android.app.Activity) = Unit
override fun onActivityResumed(activity: android.app.Activity) = syncRecents(activity)
override fun onActivityPaused(activity: android.app.Activity) { if (activity is FrontEndActivity) syncRecents(activity) }
override fun onActivityStopped(activity: android.app.Activity) = Unit
override fun onActivitySaveInstanceState(activity: android.app.Activity, outState: android.os.Bundle) = Unit
override fun onActivityDestroyed(activity: android.app.Activity) = Unit
})
}
private fun syncRecents(activity: android.app.Activity) =
keepOutOfRecents(activity, activity is FrontEndActivity && !SessionState.running && isDefault(activity))
internal enum class RecentsStep { HIDE, SHOW, FORGET, NONE }
internal fun recentsStep(hidden: Boolean, owned: Boolean, excluded: Boolean): RecentsStep = when {
hidden && !excluded -> RecentsStep.HIDE
!hidden && owned && excluded -> RecentsStep.SHOW
!hidden && owned -> RecentsStep.FORGET
else -> RecentsStep.NONE
}
fun keepOutOfRecents(activity: android.app.Activity, hidden: Boolean) {
val prefs = activity.getSharedPreferences("home-recents", Context.MODE_PRIVATE)
val owned = prefs.getStringSet("tasks", null).orEmpty()
val id = activity.taskId.toString()
if (!hidden && id !in owned) return
runCatching {
@Suppress("DEPRECATION")
fun idOf(task: android.app.ActivityManager.AppTask) =
if (Build.VERSION.SDK_INT >= 29) task.taskInfo.taskId else task.taskInfo.persistentId
val tasks = activity.getSystemService(android.app.ActivityManager::class.java).appTasks
val task = tasks.firstOrNull { idOf(it) == activity.taskId } ?: return
val excluded = task.taskInfo.baseIntent.flags and Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS != 0
val step = recentsStep(hidden, id in owned, excluded)
if (step == RecentsStep.NONE) return
if (step != RecentsStep.FORGET) task.setExcludeFromRecents(step == RecentsStep.HIDE)
val live = tasks.map { idOf(it).toString() }.toSet()
val next = owned.filter { it in live && it != id }.toMutableSet()
if (step == RecentsStep.HIDE) next += id
prefs.edit().putStringSet("tasks", next).apply()
}
}
fun startShortcut(context: Context, info: ShortcutInfo) {
val task = generateSequence(context) { (it as? android.content.ContextWrapper)?.baseContext }
.filterIsInstance<android.app.Activity>().firstOrNull()?.taskId
@@ -155,6 +155,8 @@ object DualScreenPanel {
if (ownerTask == task) ownerYielded = app
}
fun opensOutside(own: String, target: String?): Boolean = target != null && target != own
fun ownerPaused(task: Int, paused: Boolean) {
if (ownerTask == task) ownerPaused = paused
}