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

Commit 289f62a4 authored by Ben Lin's avatar Ben Lin
Browse files

DesktopTasksController: Let Wallpaper launchable on ext. displays.

By default right now the wallpaper is only launched on default display,
even if desktop mode is entered on a non-default display. Pass in a
displayId so that it can be launched on other displays.

Bug: 382023296
Test: Manual. Start Desktop Mode on ext display and see that Wallpaper
is launched along on the secondary display.
Flag: com.android.window.flags.enable_bug_fixes_for_secondary_display

Change-Id: I3e1f1342b8c5ef65a8fc9e7b711240684e5692d3
parent ef388b9e
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -1202,9 +1202,12 @@ class DesktopTasksController(
        moveHomeTask(wct, toTop = true)

        // Currently, we only handle the desktop on the default display really.
        if (displayId == DEFAULT_DISPLAY && ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY.isTrue()) {
        if (
            (displayId == DEFAULT_DISPLAY || Flags.enableBugFixesForSecondaryDisplay()) &&
                ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY.isTrue()
        ) {
            // Add translucent wallpaper activity to show the wallpaper underneath
            addWallpaperActivity(wct)
            addWallpaperActivity(displayId, wct)
        }

        val expandedTasksOrderedFrontToBack = taskRepository.getExpandedTasksOrdered(displayId)
@@ -1253,7 +1256,7 @@ class DesktopTasksController(
            ?.let { homeTask -> wct.reorder(homeTask.getToken(), /* onTop= */ toTop) }
    }

    private fun addWallpaperActivity(wct: WindowContainerTransaction) {
    private fun addWallpaperActivity(displayId: Int, wct: WindowContainerTransaction) {
        logV("addWallpaperActivity")
        val userHandle = UserHandle.of(userId)
        val userContext = context.createContextAsUser(userHandle, /* flags= */ 0)
@@ -1264,6 +1267,9 @@ class DesktopTasksController(
                launchWindowingMode = WINDOWING_MODE_FULLSCREEN
                pendingIntentBackgroundActivityStartMode =
                    ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS
                if (Flags.enableBugFixesForSecondaryDisplay()) {
                    launchDisplayId = displayId
                }
            }
        val pendingIntent =
            PendingIntent.getActivityAsUser(