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

Commit 196b1102 authored by Massimo Carli's avatar Massimo Carli Committed by Android (Google) Code Review
Browse files

Merge "[79/n] Enable rounded corners animation behind flag" into main

parents b125533d 0f2dca98
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.graphics.Rect
import android.view.SurfaceControl
import android.window.WindowContainerToken
import com.android.internal.protolog.ProtoLog
import com.android.window.flags.Flags
import com.android.wm.shell.common.ShellExecutor
import com.android.wm.shell.compatui.letterbox.LetterboxController
import com.android.wm.shell.compatui.letterbox.LetterboxKey
@@ -77,7 +78,13 @@ constructor(
    ) {
        roundedCornersMap.runOnItem(
            key.taskId,
            onFound = { item -> item.setCornersVisibility(animExecutor, visible, immediate = true) },
            onFound = { item ->
                item.setCornersVisibility(
                    animExecutor,
                    visible,
                    immediate = !Flags.appCompatRefactoringRoundedCornersAnimation(),
                )
            },
        )
    }

+29 −3
Original line number Diff line number Diff line
@@ -18,8 +18,11 @@ package com.android.wm.shell.compatui.letterbox.roundedcorners

import android.content.res.Configuration
import android.graphics.Rect
import android.platform.test.annotations.DisableFlags
import android.platform.test.annotations.EnableFlags
import android.testing.AndroidTestingRunner
import androidx.test.filters.SmallTest
import com.android.window.flags.Flags
import com.android.wm.shell.ShellTestCase
import com.android.wm.shell.TestShellExecutor
import com.android.wm.shell.compatui.letterbox.LetterboxController
@@ -109,7 +112,26 @@ class RoundedCornersLetterboxControllerTest : ShellTestCase() {
    }

    @Test
    fun `Only existing surfaces receive visibility update`() {
    @EnableFlags(Flags.FLAG_APP_COMPAT_REFACTORING_ROUNDED_CORNERS_ANIMATION)
    fun `Only existing surfaces receive visibility update with animation`() {
        runTestScenario { r ->
            r.configureRepository()
            r.configureRepository(taskId = ANOTHER_TASK_ID)
            r.sendCreateSurfaceRequest()
            r.sendUpdateSurfaceVisibilityRequest(visible = true)
            r.sendUpdateSurfaceVisibilityRequest(visible = true, taskId = ANOTHER_TASK_ID)

            r.checkRoundedCornersVisibilityUpdated(
                times = 1,
                expectedVisibility = true,
                immediate = false
            )
        }
    }

    @Test
    @DisableFlags(Flags.FLAG_APP_COMPAT_REFACTORING_ROUNDED_CORNERS_ANIMATION)
    fun `Only existing surfaces receive visibility update without animation`() {
        runTestScenario { r ->
            r.configureRepository()
            r.configureRepository(taskId = ANOTHER_TASK_ID)
@@ -191,11 +213,15 @@ class RoundedCornersLetterboxControllerTest : ShellTestCase() {
            )
        }

        fun checkRoundedCornersVisibilityUpdated(times: Int = 1, expectedVisibility: Boolean) {
        fun checkRoundedCornersVisibilityUpdated(
            times: Int = 1,
            expectedVisibility: Boolean,
            immediate: Boolean = true
        ) {
            verify(roundedCornersSurface, times(times)).setCornersVisibility(
                any(),
                eq(expectedVisibility),
                eq(true)
                eq(immediate)
            )
        }