Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75cb4640 authored by Jorge Gil's avatar Jorge Gil
Browse files

Desks: Default DesktopWallpaperActivity focusability to false

This is a follow up to Idc7ac2c374bee72bb54bd7b3a5daca915262af25.

When the activity is created for the first time, setting the focus to
true resulted in the wallpaper being touchable behind a desktop app even
though it should've been made unfocusable by a call to
onTopResumedActivityChanged. To work around this lifecycle bug, set the
focus to |false| by default. It should in theory result in a reversed
bug if entering desktop through an empty desk, but
onTopResumedActivityChanged does call back in that case.

Flag: com.android.window.flags.enable_multiple_desktops_backend
Fix: 416700931
Test: reboot, open fullscreen task, enter desktop using handle menu -
verify the wallpaper isn't touchable
Test: reboot, open fullscreen task, swipe up to overview, create empty
desk, enter empty desk - verify there's no ANR on keyboard events

Change-Id: I039abd5051b03ab17f3468434cf77c364ced403f
parent b5aff7b0
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -37,7 +37,16 @@ class DesktopWallpaperActivity : Activity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        updateFocusableFlag(focusable = true)
        Log.d(TAG, "onCreate")
        // Set to |false| by default. This shouldn't matter because
        // [Activity#onTopResumedActivityChanged] is supposed to be called after [onResume] which
        // should set the correct state. However, there's a lifecycle bug that causes it not to
        // be called after [onCreate] (see b/416700931) and may leave the wallpaper touchable after
        // entering desktop mode with another app. To prevent this make it not focusable by
        // default, as it is more likely a user will enter desktop with a task than without one
        // (entering through an empty desk may result in a reversed bug: unfocusable when we wanted
        // it to be focusable).
        updateFocusableFlag(focusable = false)
    }

    override fun onTopResumedActivityChanged(isTopResumedActivity: Boolean) {