Merge "Fix non-resizable split flicker tests" into sc-dev

This commit is contained in:
Chris Li
2021-03-19 03:19:26 +00:00
committed by Android (Google) Code Review
7 changed files with 553 additions and 64 deletions

View File

@@ -16,6 +16,8 @@
package com.android.wm.shell.flicker.legacysplitscreen
import android.platform.test.annotations.Postsubmit
import android.provider.Settings
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
@@ -28,7 +30,9 @@ import com.android.server.wm.flicker.helpers.openQuickstep
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import com.android.wm.shell.flicker.dockedStackDividerIsInvisible
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.After
import org.junit.Assert
import org.junit.Before
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -36,27 +40,31 @@ import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
/**
* Test open non-resizable activity will auto exit split screen mode
* To run this test: `atest WMShellFlickerTests:EnterSplitScreenNonResizableNotDock`
* Test enter split screen from non-resizable activity. When the device doesn't support
* non-resizable in multi window, there should be no button to enter split screen for non-resizable
* activity.
*
* To run this test: `atest WMShellFlickerTests:EnterSplitScreenNotSupportNonResizable`
*/
@Postsubmit
@RequiresDevice
@RunWith(Parameterized::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FlakyTest(bugId = 173875043)
class EnterSplitScreenNonResizableNotDock(
class EnterSplitScreenNotSupportNonResizable(
testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) {
var prevSupportNonResizableInMultiWindow = 0
override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit
get() = { configuration ->
super.transition(this, configuration)
teardown {
cleanSetup(this, configuration)
setup {
eachRun {
nonResizeableApp.exit(wmHelper)
nonResizeableApp.launchViaIntent(wmHelper)
}
}
transitions {
nonResizeableApp.launchViaIntent(wmHelper)
device.openQuickstep(wmHelper)
if (device.canSplitScreen(wmHelper)) {
Assert.fail("Non-resizeable app should not enter split screen")
@@ -71,8 +79,23 @@ class EnterSplitScreenNonResizableNotDock(
nonResizeableApp.defaultWindowName,
splitScreenApp.defaultWindowName)
@Test
fun dockedStackDividerIsInvisible() = testSpec.dockedStackDividerIsInvisible()
@Before
fun setup() {
prevSupportNonResizableInMultiWindow = Settings.Global.getInt(context.contentResolver,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW)
if (prevSupportNonResizableInMultiWindow == 1) {
// Not support non-resizable in multi window
Settings.Global.putInt(context.contentResolver,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, 0)
}
}
@After
fun teardown() {
Settings.Global.putInt(context.contentResolver,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW,
prevSupportNonResizableInMultiWindow)
}
@FlakyTest(bugId = 178447631)
@Test
@@ -83,6 +106,9 @@ class EnterSplitScreenNonResizableNotDock(
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
@Test
fun dockedStackDividerIsInvisible() = testSpec.dockedStackDividerIsInvisible()
@Test
fun appWindowIsVisible() {
testSpec.assertWmEnd {

View File

@@ -0,0 +1,123 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.wm.shell.flicker.legacysplitscreen
import android.platform.test.annotations.Postsubmit
import android.provider.Settings
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import com.android.wm.shell.flicker.dockedStackDividerIsVisible
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.After
import org.junit.Before
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
/**
* Test enter split screen from non-resizable activity. When the device supports
* non-resizable in multi window, there should be a button to enter split screen for non-resizable
* activity.
*
* To run this test: `atest WMShellFlickerTests:EnterSplitScreenSupportNonResizable`
*/
@Postsubmit
@RequiresDevice
@RunWith(Parameterized::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
class EnterSplitScreenSupportNonResizable(
testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) {
var prevSupportNonResizableInMultiWindow = 0
override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit
get() = { configuration ->
cleanSetup(this, configuration)
setup {
eachRun {
nonResizeableApp.launchViaIntent(wmHelper)
}
}
transitions {
device.launchSplitScreen(wmHelper)
}
}
override val ignoredWindows: List<String>
get() = listOf(LAUNCHER_PACKAGE_NAME,
WindowManagerStateHelper.SPLASH_SCREEN_NAME,
WindowManagerStateHelper.SNAPSHOT_WINDOW_NAME,
nonResizeableApp.defaultWindowName,
splitScreenApp.defaultWindowName)
@Before
fun setup() {
prevSupportNonResizableInMultiWindow = Settings.Global.getInt(context.contentResolver,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW)
if (prevSupportNonResizableInMultiWindow != 1) {
// Support non-resizable in multi window
Settings.Global.putInt(context.contentResolver,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, 1)
}
}
@After
fun teardown() {
Settings.Global.putInt(context.contentResolver,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW,
prevSupportNonResizableInMultiWindow)
}
@FlakyTest(bugId = 178447631)
@Test
override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
super.visibleLayersShownMoreThanOneConsecutiveEntry()
@Test
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
@Test
fun dockedStackDividerIsVisible() = testSpec.dockedStackDividerIsVisible()
@Test
fun appWindowIsVisible() {
testSpec.assertWmEnd {
isVisible(nonResizeableApp.defaultWindowName)
}
}
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = SplitScreenHelper.TEST_REPETITIONS,
supportedRotations = listOf(Surface.ROTATION_0)) // b/178685668
}
}
}

View File

@@ -0,0 +1,145 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.wm.shell.flicker.legacysplitscreen
import android.platform.test.annotations.Postsubmit
import android.provider.Settings
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.appWindowBecomesInVisible
import com.android.server.wm.flicker.appWindowBecomesVisible
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.layerBecomesInvisible
import com.android.server.wm.flicker.layerBecomesVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER
import com.android.wm.shell.flicker.dockedStackDividerIsInvisible
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.After
import org.junit.Before
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
/**
* Test launch non-resizable activity via intent in split screen mode. When the device does not
* support non-resizable in multi window, it should trigger exit split screen.
* To run this test: `atest WMShellFlickerTests:LegacySplitScreenFromIntentNotSupportNonResizable`
*/
@Postsubmit
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class LegacySplitScreenFromIntentNotSupportNonResizable(
testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) {
var prevSupportNonResizableInMultiWindow = 0
override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit
get() = { configuration ->
cleanSetup(this, configuration)
setup {
eachRun {
splitScreenApp.launchViaIntent(wmHelper)
device.launchSplitScreen(wmHelper)
}
}
transitions {
nonResizeableApp.launchViaIntent(wmHelper)
wmHelper.waitForAppTransitionIdle()
}
}
override val ignoredWindows: List<String>
get() = listOf(DOCKED_STACK_DIVIDER, LAUNCHER_PACKAGE_NAME, LETTERBOX_NAME,
nonResizeableApp.defaultWindowName, splitScreenApp.defaultWindowName,
WindowManagerStateHelper.SPLASH_SCREEN_NAME,
WindowManagerStateHelper.SNAPSHOT_WINDOW_NAME)
@Before
fun setup() {
prevSupportNonResizableInMultiWindow = Settings.Global.getInt(context.contentResolver,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW)
if (prevSupportNonResizableInMultiWindow == 1) {
// Not support non-resizable in multi window
Settings.Global.putInt(context.contentResolver,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, 0)
}
}
@After
fun teardown() {
Settings.Global.putInt(context.contentResolver,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW,
prevSupportNonResizableInMultiWindow)
}
@FlakyTest(bugId = 178447631)
@Test
override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
super.visibleLayersShownMoreThanOneConsecutiveEntry()
@FlakyTest(bugId = 178447631)
@Test
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
@Test
fun resizableAppLayerBecomesInvisible() =
testSpec.layerBecomesInvisible(splitScreenApp.defaultWindowName)
@Test
fun nonResizableAppLayerBecomesVisible() =
testSpec.layerBecomesVisible(nonResizeableApp.defaultWindowName)
@Test
fun resizableAppWindowBecomesInvisible() =
testSpec.appWindowBecomesInVisible(splitScreenApp.defaultWindowName)
@Test
fun nonResizableAppWindowBecomesVisible() =
testSpec.appWindowBecomesVisible(nonResizeableApp.defaultWindowName)
@Test
fun dockedStackDividerIsInvisibleAtEnd() = testSpec.dockedStackDividerIsInvisible()
@Test
fun onlyNonResizableAppWindowIsVisibleAtEnd() {
testSpec.assertWmEnd {
isInvisible(splitScreenApp.defaultWindowName)
isVisible(nonResizeableApp.defaultWindowName)
}
}
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = SplitScreenHelper.TEST_REPETITIONS,
supportedRotations = listOf(Surface.ROTATION_0)) // b/178685668
}
}
}

View File

@@ -16,22 +16,24 @@
package com.android.wm.shell.flicker.legacysplitscreen
import android.platform.test.annotations.Presubmit
import android.platform.test.annotations.Postsubmit
import android.provider.Settings
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.appWindowBecomesInVisible
import com.android.server.wm.flicker.appWindowBecomesVisible
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.layerBecomesInvisible
import com.android.server.wm.flicker.layerBecomesVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER
import com.android.wm.shell.flicker.dockedStackDividerIsVisible
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.After
import org.junit.Before
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -39,18 +41,20 @@ import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
/**
* Test launch non resizable activity in split screen mode will trigger exit split screen mode
* (Non resizable activity launch via intent)
* To run this test: `atest WMShellFlickerTests:NonResizableLaunchInLegacySplitScreen`
* Test launch non-resizable activity via intent in split screen mode. When the device supports
* non-resizable in multi window, it should show the non-resizable app in split screen.
* To run this test: `atest WMShellFlickerTests:LegacySplitScreenFromIntentSupportNonResizable`
*/
@Presubmit
@Postsubmit
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class NonResizableLaunchInLegacySplitScreen(
class LegacySplitScreenFromIntentSupportNonResizable(
testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) {
var prevSupportNonResizableInMultiWindow = 0
override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit
get() = { configuration ->
cleanSetup(this, configuration)
@@ -72,33 +76,52 @@ class NonResizableLaunchInLegacySplitScreen(
WindowManagerStateHelper.SPLASH_SCREEN_NAME,
WindowManagerStateHelper.SNAPSHOT_WINDOW_NAME)
@Presubmit
@Test
fun layerBecomesVisible() = testSpec.layerBecomesVisible(nonResizeableApp.defaultWindowName)
@Before
fun setup() {
prevSupportNonResizableInMultiWindow = Settings.Global.getInt(context.contentResolver,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW)
if (prevSupportNonResizableInMultiWindow == 0) {
// Support non-resizable in multi window
Settings.Global.putInt(context.contentResolver,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, 1)
}
}
@Presubmit
@Test
fun layerBecomesInvisible() = testSpec.layerBecomesInvisible(splitScreenApp.defaultWindowName)
@After
fun teardown() {
Settings.Global.putInt(context.contentResolver,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW,
prevSupportNonResizableInMultiWindow)
}
@FlakyTest(bugId = 178447631)
@Test
override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
super.visibleLayersShownMoreThanOneConsecutiveEntry()
@Presubmit
@Test
fun appWindowBecomesVisible() =
testSpec.appWindowBecomesVisible(nonResizeableApp.defaultWindowName)
@Presubmit
@Test
fun appWindowBecomesInVisible() =
testSpec.appWindowBecomesInVisible(splitScreenApp.defaultWindowName)
super.visibleLayersShownMoreThanOneConsecutiveEntry()
@FlakyTest(bugId = 178447631)
@Test
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
@Test
fun nonResizableAppLayerBecomesVisible() =
testSpec.layerBecomesVisible(nonResizeableApp.defaultWindowName)
@Test
fun nonResizableAppWindowBecomesVisible() =
testSpec.appWindowBecomesVisible(nonResizeableApp.defaultWindowName)
@Test
fun dockedStackDividerIsVisibleAtEnd() = testSpec.dockedStackDividerIsVisible()
@Test
fun bothAppsWindowsAreVisibleAtEnd() {
testSpec.assertWmEnd {
isVisible(splitScreenApp.defaultWindowName)
isVisible(nonResizeableApp.defaultWindowName)
}
}
companion object {
@Parameterized.Parameters(name = "{0}")

View File

@@ -0,0 +1,146 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.wm.shell.flicker.legacysplitscreen
import android.platform.test.annotations.Postsubmit
import android.provider.Settings
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.appWindowBecomesInVisible
import com.android.server.wm.flicker.appWindowBecomesVisible
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.helpers.reopenAppFromOverview
import com.android.server.wm.flicker.layerBecomesInvisible
import com.android.server.wm.flicker.layerBecomesVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER
import com.android.wm.shell.flicker.dockedStackDividerIsInvisible
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.After
import org.junit.Before
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
/**
* Test launch non-resizable activity via recent overview in split screen mode. When the device does
* not support non-resizable in multi window, it should trigger exit split screen.
* To run this test: `atest WMShellFlickerTests:LegacySplitScreenFromRecentNotSupportNonResizable`
*/
@Postsubmit
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class LegacySplitScreenFromRecentNotSupportNonResizable(
testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) {
var prevSupportNonResizableInMultiWindow = 0
override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit
get() = { configuration ->
cleanSetup(this, configuration)
setup {
eachRun {
nonResizeableApp.launchViaIntent(wmHelper)
splitScreenApp.launchViaIntent(wmHelper)
device.launchSplitScreen(wmHelper)
}
}
transitions {
device.reopenAppFromOverview(wmHelper)
}
}
override val ignoredWindows: List<String>
get() = listOf(DOCKED_STACK_DIVIDER, LAUNCHER_PACKAGE_NAME, LETTERBOX_NAME, TOAST_NAME,
splitScreenApp.defaultWindowName, nonResizeableApp.defaultWindowName,
WindowManagerStateHelper.SPLASH_SCREEN_NAME,
WindowManagerStateHelper.SNAPSHOT_WINDOW_NAME)
@Before
fun setup() {
prevSupportNonResizableInMultiWindow = Settings.Global.getInt(context.contentResolver,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW)
if (prevSupportNonResizableInMultiWindow == 1) {
// Not support non-resizable in multi window
Settings.Global.putInt(context.contentResolver,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, 0)
}
}
@After
fun teardown() {
Settings.Global.putInt(context.contentResolver,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW,
prevSupportNonResizableInMultiWindow)
}
@FlakyTest(bugId = 178447631)
@Test
override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
super.visibleLayersShownMoreThanOneConsecutiveEntry()
@FlakyTest(bugId = 178447631)
@Test
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
@Test
fun resizableAppLayerBecomesInvisible() =
testSpec.layerBecomesInvisible(splitScreenApp.defaultWindowName)
@Test
fun nonResizableAppLayerBecomesVisible() =
testSpec.layerBecomesVisible(nonResizeableApp.defaultWindowName)
@Test
fun resizableAppWindowBecomesInvisible() =
testSpec.appWindowBecomesInVisible(splitScreenApp.defaultWindowName)
@Test
fun nonResizableAppWindowBecomesVisible() =
testSpec.appWindowBecomesVisible(nonResizeableApp.defaultWindowName)
@Test
fun dockedStackDividerIsInvisibleAtEnd() = testSpec.dockedStackDividerIsInvisible()
@Test
fun onlyNonResizableAppWindowIsVisibleAtEnd() {
testSpec.assertWmEnd {
isInvisible(splitScreenApp.defaultWindowName)
isVisible(nonResizeableApp.defaultWindowName)
}
}
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = SplitScreenHelper.TEST_REPETITIONS,
supportedRotations = listOf(Surface.ROTATION_0)) // b/178685668
}
}
}

View File

@@ -16,23 +16,25 @@
package com.android.wm.shell.flicker.legacysplitscreen
import android.platform.test.annotations.Presubmit
import android.platform.test.annotations.Postsubmit
import android.provider.Settings
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.appWindowBecomesInVisible
import com.android.server.wm.flicker.appWindowBecomesVisible
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.helpers.reopenAppFromOverview
import com.android.server.wm.flicker.layerBecomesInvisible
import com.android.server.wm.flicker.layerBecomesVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER
import com.android.wm.shell.flicker.dockedStackDividerIsVisible
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.After
import org.junit.Before
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -40,17 +42,20 @@ import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
/**
* Test launch non resizable activity in split screen mode will trigger exit split screen mode
* (Non resizable activity launch via recent overview)
* To run this test: `atest WMShellFlickerTests:NonResizableDismissInLegacySplitScreen`
* Test launch non-resizable activity via recent overview in split screen mode. When the device
* supports non-resizable in multi window, it should show the non-resizable app in split screen.
* To run this test: `atest WMShellFlickerTests:LegacySplitScreenFromRecentSupportNonResizable`
*/
@Postsubmit
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class NonResizableDismissInLegacySplitScreen(
class LegacySplitScreenFromRecentSupportNonResizable(
testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) {
var prevSupportNonResizableInMultiWindow = 0
override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit
get() = { configuration ->
cleanSetup(this, configuration)
@@ -68,37 +73,56 @@ class NonResizableDismissInLegacySplitScreen(
override val ignoredWindows: List<String>
get() = listOf(DOCKED_STACK_DIVIDER, LAUNCHER_PACKAGE_NAME, LETTERBOX_NAME, TOAST_NAME,
splitScreenApp.defaultWindowName, nonResizeableApp.defaultWindowName,
WindowManagerStateHelper.SPLASH_SCREEN_NAME,
WindowManagerStateHelper.SNAPSHOT_WINDOW_NAME)
splitScreenApp.defaultWindowName, nonResizeableApp.defaultWindowName,
WindowManagerStateHelper.SPLASH_SCREEN_NAME,
WindowManagerStateHelper.SNAPSHOT_WINDOW_NAME)
@Presubmit
@Test
fun layerBecomesInvisible() = testSpec.layerBecomesInvisible(splitScreenApp.defaultWindowName)
@Before
fun setup() {
prevSupportNonResizableInMultiWindow = Settings.Global.getInt(context.contentResolver,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW)
if (prevSupportNonResizableInMultiWindow == 0) {
// Support non-resizable in multi window
Settings.Global.putInt(context.contentResolver,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, 1)
}
}
@After
fun teardown() {
Settings.Global.putInt(context.contentResolver,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW,
prevSupportNonResizableInMultiWindow)
}
@FlakyTest(bugId = 178447631)
@Test
override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
super.visibleLayersShownMoreThanOneConsecutiveEntry()
@Presubmit
@Test
fun layerBecomesVisible() = testSpec.layerBecomesVisible(nonResizeableApp.defaultWindowName)
@Presubmit
@Test
fun appWindowBecomesVisible() =
testSpec.appWindowBecomesVisible(nonResizeableApp.defaultWindowName)
@Presubmit
@Test
fun appWindowBecomesInVisible() =
testSpec.appWindowBecomesInVisible(splitScreenApp.defaultWindowName)
@FlakyTest(bugId = 178447631)
@Test
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
@Test
fun nonResizableAppLayerBecomesVisible() =
testSpec.layerBecomesVisible(nonResizeableApp.defaultWindowName)
@Test
fun nonResizableAppWindowBecomesVisible() =
testSpec.appWindowBecomesVisible(nonResizeableApp.defaultWindowName)
@Test
fun dockedStackDividerIsVisibleAtEnd() = testSpec.dockedStackDividerIsVisible()
@Test
fun bothAppsWindowsAreVisibleAtEnd() {
testSpec.assertWmEnd {
isVisible(splitScreenApp.defaultWindowName)
isVisible(nonResizeableApp.defaultWindowName)
}
}
companion object {
@Parameterized.Parameters(name = "{0}")

View File

@@ -17,6 +17,7 @@
package com.android.wm.shell.flicker.legacysplitscreen
import android.app.Instrumentation
import android.content.Context
import android.platform.test.annotations.Presubmit
import android.support.test.launcherhelper.LauncherStrategyFactory
import android.view.Surface
@@ -36,6 +37,7 @@ import org.junit.Test
abstract class LegacySplitScreenTransition(protected val testSpec: FlickerTestParameter) {
protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
protected val context: Context = instrumentation.context
protected val isRotated = testSpec.config.startRotation.isRotated()
protected val splitScreenApp = SplitScreenHelper.getPrimary(instrumentation)
protected val secondaryApp = SplitScreenHelper.getSecondary(instrumentation)