Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/config/DefaultLetterboxDependenciesHelper.kt +6 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,10 @@ import com.android.wm.shell.desktopmode.DesktopRepository class DefaultLetterboxDependenciesHelper(val desktopRepository: DesktopRepository) : LetterboxDependenciesHelper { override fun shouldDestroyLetterboxSurfaces(change: TransitionInfo.Change): Boolean = desktopRepository.isAnyDeskActive(change.endDisplayId) /** * When in Desktop Windowing the reachability feature is disabled so the creation of the input * surface for event detection can be ignored. */ override fun shouldSupportInputSurface(change: TransitionInfo.Change): Boolean = !desktopRepository.isAnyDeskActive(change.endDisplayId) } libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/config/IgnoreLetterboxDependenciesHelper.kt +3 −3 Original line number Diff line number Diff line Loading @@ -24,9 +24,9 @@ import android.window.TransitionInfo.Change * that don't allow the Desktop Windowing feature (a.g. Auto). */ class IgnoreLetterboxDependenciesHelper : LetterboxDependenciesHelper { /** * We should ignore all the changes related to Desktop Windowing when the feature is not * available. * By default the input surface should always be created. */ override fun shouldDestroyLetterboxSurfaces(change: Change): Boolean = false override fun shouldSupportInputSurface(change: Change): Boolean = true } libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/config/LetterboxDependenciesHelper.kt +2 −2 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ import android.window.TransitionInfo.Change interface LetterboxDependenciesHelper { /** * Tells if we need to destroy the existing letterbox surfaces for a given [Change]. * Tells if the input surface should be created or not. This enables reachability. */ fun shouldDestroyLetterboxSurfaces(change: Change): Boolean fun shouldSupportInputSurface(change: Change): Boolean } libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/config/DefaultLetterboxDependenciesHelperTest.kt +8 −8 Original line number Diff line number Diff line Loading @@ -41,26 +41,26 @@ import org.mockito.kotlin.mock class DefaultLetterboxDependenciesHelperTest : ShellTestCase() { @Test fun `Should not destroy letterbox surfaces if not isAnyDeskActive`() { fun `When in Desktop Windowing the input surface should not be created`() { runTestScenario { r -> testLetterboxDependenciesHelper(r.getLetterboxLifecycleEventFactory()) { inputChange { } r.configureDesktopRepository(isAnyDeskActive = false) validateIsDesktopWindowingAction { shouldDestroy -> assertFalse(shouldDestroy) r.configureDesktopRepository(isAnyDeskActive = true) validateShouldSupportInputSurface { shouldSupportInputSurface -> assertFalse(shouldSupportInputSurface) } } } } @Test fun `Should destroy letterbox surfaces if isAnyDeskActive`() { fun `When NOT in Desktop Windowing the input surface should be created`() { runTestScenario { r -> testLetterboxDependenciesHelper(r.getLetterboxLifecycleEventFactory()) { inputChange { } r.configureDesktopRepository(isAnyDeskActive = true) validateIsDesktopWindowingAction { shouldDestroy -> assertTrue(shouldDestroy) r.configureDesktopRepository(isAnyDeskActive = false) validateShouldSupportInputSurface { shouldSupportInputSurface -> assertTrue(shouldSupportInputSurface) } } } Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/util/LetterboxDependenciesHelperUtils.kt +2 −2 Original line number Diff line number Diff line Loading @@ -28,9 +28,9 @@ class LetterboxDependenciesHelperTestContext( val deskId: Int = -1 fun validateIsDesktopWindowingAction(verifier: (Boolean) -> Unit) { fun validateShouldSupportInputSurface(verifier: (Boolean) -> Unit) { // We execute the test subject using the input verifier(testSubjectFactory().shouldDestroyLetterboxSurfaces(inputObject)) verifier(testSubjectFactory().shouldSupportInputSurface(inputObject)) } } Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/config/DefaultLetterboxDependenciesHelper.kt +6 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,10 @@ import com.android.wm.shell.desktopmode.DesktopRepository class DefaultLetterboxDependenciesHelper(val desktopRepository: DesktopRepository) : LetterboxDependenciesHelper { override fun shouldDestroyLetterboxSurfaces(change: TransitionInfo.Change): Boolean = desktopRepository.isAnyDeskActive(change.endDisplayId) /** * When in Desktop Windowing the reachability feature is disabled so the creation of the input * surface for event detection can be ignored. */ override fun shouldSupportInputSurface(change: TransitionInfo.Change): Boolean = !desktopRepository.isAnyDeskActive(change.endDisplayId) }
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/config/IgnoreLetterboxDependenciesHelper.kt +3 −3 Original line number Diff line number Diff line Loading @@ -24,9 +24,9 @@ import android.window.TransitionInfo.Change * that don't allow the Desktop Windowing feature (a.g. Auto). */ class IgnoreLetterboxDependenciesHelper : LetterboxDependenciesHelper { /** * We should ignore all the changes related to Desktop Windowing when the feature is not * available. * By default the input surface should always be created. */ override fun shouldDestroyLetterboxSurfaces(change: Change): Boolean = false override fun shouldSupportInputSurface(change: Change): Boolean = true }
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/config/LetterboxDependenciesHelper.kt +2 −2 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ import android.window.TransitionInfo.Change interface LetterboxDependenciesHelper { /** * Tells if we need to destroy the existing letterbox surfaces for a given [Change]. * Tells if the input surface should be created or not. This enables reachability. */ fun shouldDestroyLetterboxSurfaces(change: Change): Boolean fun shouldSupportInputSurface(change: Change): Boolean }
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/config/DefaultLetterboxDependenciesHelperTest.kt +8 −8 Original line number Diff line number Diff line Loading @@ -41,26 +41,26 @@ import org.mockito.kotlin.mock class DefaultLetterboxDependenciesHelperTest : ShellTestCase() { @Test fun `Should not destroy letterbox surfaces if not isAnyDeskActive`() { fun `When in Desktop Windowing the input surface should not be created`() { runTestScenario { r -> testLetterboxDependenciesHelper(r.getLetterboxLifecycleEventFactory()) { inputChange { } r.configureDesktopRepository(isAnyDeskActive = false) validateIsDesktopWindowingAction { shouldDestroy -> assertFalse(shouldDestroy) r.configureDesktopRepository(isAnyDeskActive = true) validateShouldSupportInputSurface { shouldSupportInputSurface -> assertFalse(shouldSupportInputSurface) } } } } @Test fun `Should destroy letterbox surfaces if isAnyDeskActive`() { fun `When NOT in Desktop Windowing the input surface should be created`() { runTestScenario { r -> testLetterboxDependenciesHelper(r.getLetterboxLifecycleEventFactory()) { inputChange { } r.configureDesktopRepository(isAnyDeskActive = true) validateIsDesktopWindowingAction { shouldDestroy -> assertTrue(shouldDestroy) r.configureDesktopRepository(isAnyDeskActive = false) validateShouldSupportInputSurface { shouldSupportInputSurface -> assertTrue(shouldSupportInputSurface) } } } Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/util/LetterboxDependenciesHelperUtils.kt +2 −2 Original line number Diff line number Diff line Loading @@ -28,9 +28,9 @@ class LetterboxDependenciesHelperTestContext( val deskId: Int = -1 fun validateIsDesktopWindowingAction(verifier: (Boolean) -> Unit) { fun validateShouldSupportInputSurface(verifier: (Boolean) -> Unit) { // We execute the test subject using the input verifier(testSubjectFactory().shouldDestroyLetterboxSurfaces(inputObject)) verifier(testSubjectFactory().shouldSupportInputSurface(inputObject)) } } Loading