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

Commit 02bb6c01 authored by Massimo Carli's avatar Massimo Carli
Browse files

[50/n] Rename leash to taskLeash to use in Letterbox Surface creation

Makes more explicit the fact that the leash in this case is the
leash of the Task and it's used as parent surface for the
letterbox surfaces.

Flag: com.android.window.flags.app_compat_refactoring
Bug: 375339716
Test: atest WMShellUnitTests:LetterboxLifecycleControllerImplTest
Test: atest WMShellUnitTests:LetterboxLifecycleEventTest
Test: atest WMShellUnitTests:TaskInfoLetterboxLifecycleEventFactoryTest

Change-Id: I47cfc9b55710d47ea395b3c15cab1c75b562228d
parent f99a826e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -41,11 +41,11 @@ class LetterboxLifecycleControllerImpl(
            if (event.letterboxBounds != null) {
                // In this case the top Activity is letterboxed.
                letterboxModeStrategy.configureLetterboxMode()
                event.leash?.let { leash ->
                event.taskLeash?.let { taskLeash ->
                    createLetterboxSurface(
                        key,
                        startTransaction,
                        leash,
                        taskLeash,
                        event.containerToken
                    )
                }
+2 −2
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ data class LetterboxLifecycleEvent(
    val taskBounds: Rect,
    val letterboxBounds: Rect? = null,
    val containerToken: WindowContainerToken? = null,
    val leash: SurfaceControl? = null,
    val taskLeash: SurfaceControl? = null,
)

/**
@@ -91,6 +91,6 @@ fun Change.toLetterboxLifecycleEvent(): LetterboxLifecycleEvent {
        taskBounds = taskBounds,
        letterboxBounds = letterboxBounds,
        containerToken = taskInfo?.token,
        leash = leash
        taskLeash = leash
    )
}
+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ class TaskInfoLetterboxLifecycleEventFactory : LetterboxLifecycleEventFactory {
                taskBounds = taskBounds,
                letterboxBounds = letterboxBounds,
                containerToken = ti.token,
                leash = change.leash
                taskLeash = change.leash
            )
        }
        return null
+7 −7
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ class LetterboxLifecycleControllerImplTest : ShellTestCase() {
                r.createLifecycleEvent(
                    type = LetterboxLifecycleEventType.OPEN,
                    letterboxBounds = Rect(500, 0, 800, 1800),
                    letterboxActivityLeash = null
                    eventTaskLeash = null
                )
            )
            r.verifyCreateLetterboxSurface(expected = false)
@@ -99,7 +99,7 @@ class LetterboxLifecycleControllerImplTest : ShellTestCase() {
                r.createLifecycleEvent(
                    type = LetterboxLifecycleEventType.OPEN,
                    letterboxBounds = Rect(500, 0, 800, 1800),
                    letterboxActivityLeash = null
                    eventTaskLeash = null
                )
            )
            r.verifyUpdateLetterboxSurfaceBounds(
@@ -125,7 +125,7 @@ class LetterboxLifecycleControllerImplTest : ShellTestCase() {
        private val startTransaction: Transaction
        private val finishTransaction: Transaction
        private val token: WindowContainerToken
        private val leash: SurfaceControl
        private val taskLeash: SurfaceControl

        companion object {
            @JvmStatic
@@ -144,7 +144,7 @@ class LetterboxLifecycleControllerImplTest : ShellTestCase() {
            startTransaction = mock<Transaction>()
            finishTransaction = mock<Transaction>()
            token = mock<WindowContainerToken>()
            leash = mock<SurfaceControl>()
            taskLeash = mock<SurfaceControl>()
            lifecycleController = LetterboxLifecycleControllerImpl(
                letterboxController,
                letterboxModeStrategy
@@ -158,7 +158,7 @@ class LetterboxLifecycleControllerImplTest : ShellTestCase() {
            taskBounds: Rect = TASK_BOUNDS,
            letterboxBounds: Rect? = null,
            letterboxActivityToken: WindowContainerToken = token,
            letterboxActivityLeash: SurfaceControl? = leash
            eventTaskLeash: SurfaceControl? = taskLeash
        ): LetterboxLifecycleEvent = LetterboxLifecycleEvent(
            type = type,
            displayId = displayId,
@@ -166,7 +166,7 @@ class LetterboxLifecycleControllerImplTest : ShellTestCase() {
            taskBounds = taskBounds,
            letterboxBounds = letterboxBounds,
            containerToken = letterboxActivityToken,
            leash = letterboxActivityLeash
            taskLeash = eventTaskLeash
        )

        fun invokeLifecycleControllerWith(event: LetterboxLifecycleEvent) {
@@ -188,7 +188,7 @@ class LetterboxLifecycleControllerImplTest : ShellTestCase() {
            ).createLetterboxSurface(
                eq(LetterboxKey(displayId, taskId)),
                eq(startTransaction),
                eq(leash),
                eq(taskLeash),
                eq(token)
            )
        }
+4 −4
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ class LetterboxLifecycleEventTest : ShellTestCase() {
    }

    @Test
    fun `Use correct Lash`() {
    fun `Use correct Leash for creation`() {
        runTestScenario { r ->
            val testLeash: SurfaceControl = mock()
            r.configureChange(
@@ -154,7 +154,7 @@ class LetterboxLifecycleEventTest : ShellTestCase() {
                leash = testLeash
            )
            r.createLetterboxLifecycleEvent()
            r.checkLetterboxActivityLeash(expected = testLeash)
            r.checkTaskLeash(expected = testLeash)
        }
    }

@@ -253,8 +253,8 @@ class LetterboxLifecycleEventTest : ShellTestCase() {
            assertEquals(expected, event?.containerToken)
        }

        fun checkLetterboxActivityLeash(expected: SurfaceControl?) {
            assertEquals(expected, event?.leash)
        fun checkTaskLeash(expected: SurfaceControl?) {
            assertEquals(expected, event?.taskLeash)
        }

        fun checkLetterboxKey(expected: LetterboxKey) {
Loading