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

Commit 707167d8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Do not create desks in invalid displays" into main

parents 4eea1f34 df6b1338
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import android.os.IBinder
import android.os.SystemProperties
import android.os.UserHandle
import android.util.Slog
import android.view.Display
import android.view.Display.DEFAULT_DISPLAY
import android.view.DragEvent
import android.view.MotionEvent
@@ -463,6 +464,10 @@ class DesktopTasksController(

    /** Creates a new desk in the given display. */
    fun createDesk(displayId: Int) {
        if (displayId == Display.INVALID_DISPLAY) {
            logW("createDesk attempt with invalid displayId", displayId)
            return
        }
        if (DesktopExperienceFlags.ENABLE_MULTIPLE_DESKTOPS_BACKEND.isTrue) {
            desksOrganizer.createDesk(displayId) { deskId ->
                taskRepository.addDesk(displayId = displayId, deskId = deskId)
+9 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ import android.platform.test.flag.junit.FlagsParameterization
import android.testing.TestableContext
import android.view.Display
import android.view.Display.DEFAULT_DISPLAY
import android.view.Display.INVALID_DISPLAY
import android.view.DragEvent
import android.view.Gravity
import android.view.MotionEvent
@@ -7350,6 +7351,14 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
        assertThat(taskRepository.getNumberOfDesks(DEFAULT_DISPLAY)).isEqualTo(currentDeskCount + 1)
    }

    @Test
    @EnableFlags(Flags.FLAG_ENABLE_MULTIPLE_DESKTOPS_BACKEND)
    fun testCreateDesk_invalidDisplay_dropsRequest() {
        controller.createDesk(INVALID_DISPLAY)

        verify(desksOrganizer, never()).createDesk(any(), any())
    }

    @Test
    @EnableFlags(
        Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY,