Add support for Tablets on IME tests

Moreover, refactor the test to reuse the base test class with general assertions and fix ktlint errors

Bug: 234735502
Test: atest FlickerTests
Change-Id: I72f8c6bdb3253237f9a7dc37e6e07f7b33104698
This commit is contained in:
Nataniel Borges
2022-07-10 16:40:35 +00:00
parent a58f157d7a
commit 389f1d9a97
15 changed files with 821 additions and 825 deletions

View File

@@ -16,27 +16,18 @@
package com.android.server.wm.flicker.ime
import android.app.Instrumentation
import android.platform.test.annotations.FlakyTest
import android.platform.test.annotations.Presubmit
import android.view.Surface
import android.view.WindowManagerPolicyConstants
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.BaseTest
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.annotation.Group2
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.entireScreenCovered
import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper
import com.android.server.wm.flicker.navBarLayerIsVisible
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.FixMethodOrder
import org.junit.Test
@@ -61,44 +52,31 @@ import org.junit.runners.Parameterized
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group2
class CloseImeAutoOpenWindowToAppTest(private val testSpec: FlickerTestParameter) {
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
class CloseImeAutoOpenWindowToAppTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
private val testApp = ImeAppAutoFocusHelper(instrumentation, testSpec.startRotation)
@FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply {
setup {
eachRun {
testApp.launchViaIntent(wmHelper)
}
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
eachRun {
testApp.launchViaIntent(wmHelper)
}
teardown {
eachRun {
testApp.exit(wmHelper)
}
}
transitions {
testApp.closeIME(wmHelper)
}
teardown {
eachRun {
testApp.exit(wmHelper)
}
}
transitions {
testApp.closeIME(wmHelper)
}
}
@Presubmit
/** {@inheritDoc} */
@FlakyTest(bugId = 206753786)
@Test
fun navBarWindowIsVisible() = testSpec.navBarWindowIsVisible()
@Presubmit
@Test
fun statusBarWindowIsVisible() = testSpec.statusBarWindowIsVisible()
@Presubmit
@Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
testSpec.assertWm {
this.visibleWindowsShownMoreThanOneConsecutiveEntry()
}
}
override fun statusBarLayerPositionAtStartAndEnd() =
super.statusBarLayerPositionAtStartAndEnd()
@Presubmit
@Test
@@ -108,18 +86,6 @@ class CloseImeAutoOpenWindowToAppTest(private val testSpec: FlickerTestParameter
}
}
@Presubmit
@Test
fun navBarLayerIsVisible() = testSpec.navBarLayerIsVisible()
@Presubmit
@Test
fun statusBarLayerIsVisible() = testSpec.statusBarLayerIsVisible()
@Presubmit
@Test
fun entireScreenCovered() = testSpec.entireScreenCovered()
@Presubmit
@Test
fun imeLayerVisibleStart() {
@@ -148,33 +114,19 @@ class CloseImeAutoOpenWindowToAppTest(private val testSpec: FlickerTestParameter
}
}
@Presubmit
@Test
fun navBarLayerRotatesAndScales() = testSpec.navBarLayerRotatesAndScales()
@FlakyTest(bugId = 206753786)
@Test
fun statusBarLayerRotatesScales() = testSpec.statusBarLayerRotatesScales()
@Presubmit
@Test
fun visibleLayersShownMoreThanOneConsecutiveEntry() {
testSpec.assertLayers {
this.visibleLayersShownMoreThanOneConsecutiveEntry()
}
}
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance()
.getConfigNonRotationTests(repetitions = 3,
.getConfigNonRotationTests(
repetitions = 3,
// b/190352379 (IME doesn't show on app launch in 90 degrees)
supportedRotations = listOf(Surface.ROTATION_0),
supportedNavigationModes = listOf(
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY)
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
)
)
}
}

View File

@@ -16,27 +16,18 @@
package com.android.server.wm.flicker.ime
import android.app.Instrumentation
import android.platform.test.annotations.FlakyTest
import android.platform.test.annotations.Presubmit
import android.view.Surface
import android.view.WindowManagerPolicyConstants
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.BaseTest
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.annotation.Group2
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.entireScreenCovered
import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper
import com.android.server.wm.flicker.navBarLayerIsVisible
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.FixMethodOrder
import org.junit.Test
@@ -61,48 +52,35 @@ import org.junit.runners.Parameterized
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group2
class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParameter) {
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
class CloseImeAutoOpenWindowToHomeTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
private val testApp = ImeAppAutoFocusHelper(instrumentation, testSpec.startRotation)
@FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply {
setup {
eachRun {
testApp.launchViaIntent(wmHelper)
}
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
eachRun {
testApp.launchViaIntent(wmHelper)
}
teardown {
eachRun {
testApp.exit(wmHelper)
}
}
transitions {
device.pressHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.withImeGone()
.waitForAndVerify()
}
teardown {
eachRun {
testApp.exit(wmHelper)
}
}
transitions {
device.pressHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.withImeGone()
.waitForAndVerify()
}
}
@Presubmit
/** {@inheritDoc} */
@FlakyTest(bugId = 206753786)
@Test
fun navBarWindowIsVisible() = testSpec.navBarWindowIsVisible()
@Presubmit
@Test
fun statusBarWindowIsVisible() = testSpec.statusBarWindowIsVisible()
@Presubmit
@Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
testSpec.assertWm {
this.visibleWindowsShownMoreThanOneConsecutiveEntry()
}
}
override fun statusBarLayerPositionAtStartAndEnd() =
super.statusBarLayerPositionAtStartAndEnd()
@Presubmit
@Test
@@ -114,10 +92,6 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete
}
}
@Presubmit
@Test
fun entireScreenCovered() = testSpec.entireScreenCovered()
@Presubmit
@Test
fun imeLayerVisibleStart() {
@@ -148,32 +122,6 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete
}
}
@Presubmit
@Test
fun navBarLayerRotatesAndScales() = testSpec.navBarLayerRotatesAndScales()
@FlakyTest(bugId = 206753786)
@Test
fun statusBarLayerRotatesScales() = testSpec.statusBarLayerRotatesScales()
@Presubmit
@Test
fun navBarLayerIsVisible() = testSpec.navBarLayerIsVisible()
@Presubmit
@Test
fun statusBarLayerIsVisible() = testSpec.statusBarLayerIsVisible()
@Presubmit
@Test
fun visibleLayersShownMoreThanOneConsecutiveEntry() {
testSpec.assertLayers {
this.visibleLayersShownMoreThanOneConsecutiveEntry(listOf(
ComponentMatcher.IME,
ComponentMatcher.SPLASH_SCREEN))
}
}
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic

View File

@@ -16,21 +16,17 @@
package com.android.server.wm.flicker.ime
import android.app.Instrumentation
import android.platform.test.annotations.Postsubmit
import android.view.Surface
import android.view.WindowManagerPolicyConstants
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.BaseTest
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.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.ImeEditorPopupDialogAppHelper
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.flicker.traces.region.RegionSubject
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.FixMethodOrder
@@ -44,44 +40,94 @@ import org.junit.runners.Parameterized
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group4
class CloseImeEditorPopupDialogTest(private val testSpec: FlickerTestParameter) {
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
class CloseImeEditorPopupDialogTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
private val imeTestApp = ImeEditorPopupDialogAppHelper(instrumentation, testSpec.startRotation)
@FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply {
setup {
eachRun {
imeTestApp.launchViaIntent(wmHelper)
imeTestApp.openIME(wmHelper)
}
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
eachRun {
imeTestApp.launchViaIntent(wmHelper)
imeTestApp.openIME(wmHelper)
}
transitions {
imeTestApp.dismissDialog(wmHelper)
}
transitions {
imeTestApp.dismissDialog(wmHelper)
wmHelper.StateSyncBuilder()
.withImeGone()
.waitForAndVerify()
}
teardown {
eachRun {
device.pressHome()
wmHelper.StateSyncBuilder()
.withImeGone()
.withHomeActivityVisible()
.waitForAndVerify()
}
teardown {
eachRun {
device.pressHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.waitForAndVerify()
imeTestApp.exit(wmHelper)
}
imeTestApp.exit(wmHelper)
}
}
}
/** {@inheritDoc} */
@Postsubmit
@Test
fun navBarWindowIsVisible() = testSpec.navBarWindowIsVisible()
override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible()
/** {@inheritDoc} */
@Postsubmit
@Test
fun statusBarWindowIsVisible() = testSpec.statusBarWindowIsVisible()
override fun taskBarWindowIsAlwaysVisible() = super.taskBarWindowIsAlwaysVisible()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun statusBarWindowIsAlwaysVisible() = super.statusBarWindowIsAlwaysVisible()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun entireScreenCovered() =
super.entireScreenCovered()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun navBarLayerIsVisibleAtStartAndEnd() = super.navBarLayerIsVisibleAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun statusBarLayerIsVisibleAtStartAndEnd() =
super.statusBarLayerIsVisibleAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun statusBarLayerPositionAtStartAndEnd() =
super.statusBarLayerPositionAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun taskBarLayerIsVisibleAtStartAndEnd() =
super.taskBarLayerIsVisibleAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
super.visibleLayersShownMoreThanOneConsecutiveEntry()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
@Postsubmit
@Test
@@ -92,11 +138,11 @@ class CloseImeEditorPopupDialogTest(private val testSpec: FlickerTestParameter)
fun imeLayerAndImeSnapshotVisibleOnScreen() {
testSpec.assertLayers {
this.isVisible(ComponentMatcher.IME)
.then()
.isVisible(ComponentMatcher.IME_SNAPSHOT)
.then()
.isInvisible(ComponentMatcher.IME_SNAPSHOT, isOptional = true)
.isInvisible(ComponentMatcher.IME)
.then()
.isVisible(ComponentMatcher.IME_SNAPSHOT)
.then()
.isInvisible(ComponentMatcher.IME_SNAPSHOT, isOptional = true)
.isInvisible(ComponentMatcher.IME)
}
}
@@ -105,13 +151,15 @@ class CloseImeEditorPopupDialogTest(private val testSpec: FlickerTestParameter)
fun imeSnapshotAssociatedOnAppVisibleRegion() {
testSpec.assertLayers {
this.invoke("imeSnapshotAssociatedOnAppVisibleRegion") {
val imeSnapshotLayers = it.subjects.filter {
subject -> subject.name.contains(
ComponentMatcher.IME_SNAPSHOT.toLayerName()) && subject.isVisible
val imeSnapshotLayers = it.subjects.filter { subject ->
subject.name.contains(
ComponentMatcher.IME_SNAPSHOT.toLayerName()
) && subject.isVisible
}
if (imeSnapshotLayers.isNotEmpty()) {
val visibleAreas = imeSnapshotLayers.mapNotNull { imeSnapshotLayer ->
imeSnapshotLayer.layer?.visibleRegion }.toTypedArray()
imeSnapshotLayer.layer?.visibleRegion
}.toTypedArray()
val imeVisibleRegion = RegionSubject.assertThat(visibleAreas, this, timestamp)
val appVisibleRegion = it.visibleRegion(imeTestApp)
if (imeVisibleRegion.region.isNotEmpty) {
@@ -127,14 +175,14 @@ class CloseImeEditorPopupDialogTest(private val testSpec: FlickerTestParameter)
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance()
.getConfigNonRotationTests(
repetitions = 2,
supportedNavigationModes = listOf(
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
),
supportedRotations = listOf(Surface.ROTATION_0)
)
.getConfigNonRotationTests(
repetitions = 2,
supportedNavigationModes = listOf(
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
),
supportedRotations = listOf(Surface.ROTATION_0)
)
}
}
}

View File

@@ -16,27 +16,19 @@
package com.android.server.wm.flicker.ime
import android.app.Instrumentation
import android.platform.test.annotations.FlakyTest
import android.platform.test.annotations.Presubmit
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.BaseTest
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.annotation.Group2
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.entireScreenCovered
import com.android.server.wm.flicker.helpers.ImeAppHelper
import com.android.server.wm.flicker.navBarLayerIsVisible
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.flicker.navBarLayerPositionAtStartAndEnd
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.Assume.assumeFalse
import org.junit.Assume.assumeTrue
import org.junit.Assume
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -52,43 +44,33 @@ import org.junit.runners.Parameterized
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group2
class CloseImeWindowToAppTest(private val testSpec: FlickerTestParameter) {
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
class CloseImeWindowToAppTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
private val testApp = ImeAppHelper(instrumentation)
@FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply {
setup {
test {
testApp.launchViaIntent(wmHelper)
}
eachRun {
testApp.openIME(wmHelper)
}
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
test {
testApp.launchViaIntent(wmHelper)
}
teardown {
test {
testApp.exit(wmHelper)
}
eachRun {
testApp.openIME(wmHelper)
}
transitions {
testApp.closeIME(wmHelper)
}
teardown {
test {
testApp.exit(wmHelper)
}
}
transitions {
testApp.closeIME(wmHelper)
}
}
/** {@inheritDoc} */
@Presubmit
@Test
fun navBarWindowIsVisible() = testSpec.navBarWindowIsVisible()
@Presubmit
@Test
fun statusBarWindowIsVisible() = testSpec.statusBarWindowIsVisible()
@Presubmit
@Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
testSpec.assertWm {
this.visibleWindowsShownMoreThanOneConsecutiveEntry(listOf(
ComponentMatcher.IME,
@@ -97,51 +79,28 @@ class CloseImeWindowToAppTest(private val testSpec: FlickerTestParameter) {
}
}
/** {@inheritDoc} */
@Presubmit
@Test
fun imeAppWindowIsAlwaysVisible() {
testSpec.assertWm {
this.isAppWindowOnTop(testApp)
}
}
@Presubmit
@Test
fun navBarLayerIsVisible() = testSpec.navBarLayerIsVisible()
@Presubmit
@Test
fun statusBarLayerIsVisible() = testSpec.navBarLayerIsVisible()
@Presubmit
@Test
fun entireScreenCovered() = testSpec.entireScreenCovered()
@Presubmit
@Test
fun navBarLayerRotatesAndScales() {
assumeFalse(testSpec.isLandscapeOrSeascapeAtStart)
testSpec.navBarLayerRotatesAndScales()
override fun navBarLayerPositionAtStartAndEnd() {
Assume.assumeFalse(testSpec.isTablet)
Assume.assumeFalse(testSpec.isLandscapeOrSeascapeAtStart)
testSpec.navBarLayerPositionAtStartAndEnd()
}
@FlakyTest
@Test
fun navBarLayerRotatesAndScales_Flaky() {
assumeTrue(testSpec.isLandscapeOrSeascapeAtStart)
testSpec.navBarLayerRotatesAndScales()
fun navBarLayerPositionAtStartAndEndLandscapeOrSeascapeAtStart() {
Assume.assumeFalse(testSpec.isTablet)
Assume.assumeTrue(testSpec.isLandscapeOrSeascapeAtStart)
testSpec.navBarLayerPositionAtStartAndEnd()
}
/** {@inheritDoc} */
@FlakyTest(bugId = 206753786)
@Test
fun statusBarLayerRotatesScales() = testSpec.statusBarLayerRotatesScales()
@Presubmit
@Test
fun visibleLayersShownMoreThanOneConsecutiveEntry() {
testSpec.assertLayers {
this.visibleLayersShownMoreThanOneConsecutiveEntry()
}
}
override fun statusBarLayerPositionAtStartAndEnd() =
super.statusBarLayerPositionAtStartAndEnd()
@Presubmit
@Test
@@ -155,6 +114,14 @@ class CloseImeWindowToAppTest(private val testSpec: FlickerTestParameter) {
}
}
@Presubmit
@Test
fun imeAppWindowIsAlwaysVisible() {
testSpec.assertWm {
this.isAppWindowOnTop(testApp)
}
}
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic

View File

@@ -16,26 +16,18 @@
package com.android.server.wm.flicker.ime
import android.app.Instrumentation
import android.platform.test.annotations.FlakyTest
import android.platform.test.annotations.Presubmit
import android.view.Surface
import android.view.WindowManagerPolicyConstants
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.BaseTest
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.annotation.Group2
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.entireScreenCovered
import com.android.server.wm.flicker.helpers.ImeAppHelper
import com.android.server.wm.flicker.navBarLayerIsVisible
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.FixMethodOrder
import org.junit.Test
@@ -52,53 +44,70 @@ import org.junit.runners.Parameterized
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group2
class CloseImeWindowToHomeTest(private val testSpec: FlickerTestParameter) {
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
class CloseImeWindowToHomeTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
private val testApp = ImeAppHelper(instrumentation)
@FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply {
setup {
eachRun {
testApp.launchViaIntent(wmHelper)
testApp.openIME(wmHelper)
}
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
eachRun {
testApp.launchViaIntent(wmHelper)
testApp.openIME(wmHelper)
}
transitions {
device.pressHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.withImeGone()
.waitForAndVerify()
}
teardown {
test {
testApp.exit(wmHelper)
}
}
transitions {
device.pressHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.withImeGone()
.waitForAndVerify()
}
teardown {
test {
testApp.exit(wmHelper)
}
}
}
/** {@inheritDoc} */
@Presubmit
@Test
fun navBarWindowIsVisible() = testSpec.navBarWindowIsVisible()
@Presubmit
@Test
fun statusBarWindowIsVisible() = testSpec.statusBarWindowIsVisible()
@Presubmit
@Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
testSpec.assertWm {
this.visibleWindowsShownMoreThanOneConsecutiveEntry(listOf(
ComponentMatcher.IME,
ComponentMatcher.SPLASH_SCREEN,
ComponentMatcher.SNAPSHOT))
this.visibleWindowsShownMoreThanOneConsecutiveEntry(
listOf(
ComponentMatcher.IME,
ComponentMatcher.SPLASH_SCREEN,
ComponentMatcher.SNAPSHOT
)
)
}
}
/** {@inheritDoc} */
@FlakyTest(bugId = 206753786)
@Test
override fun statusBarLayerPositionAtStartAndEnd() =
super.statusBarLayerPositionAtStartAndEnd()
/** {@inheritDoc} */
@Presubmit
@Test
override fun visibleLayersShownMoreThanOneConsecutiveEntry() {
testSpec.assertLayers {
this.visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(
ComponentMatcher.IME,
ComponentMatcher.SPLASH_SCREEN
)
)
}
}
@Presubmit
@Test
fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()
@Presubmit
@Test
fun imeWindowBecomesInvisible() = testSpec.imeWindowBecomesInvisible()
@@ -108,52 +117,18 @@ class CloseImeWindowToHomeTest(private val testSpec: FlickerTestParameter) {
fun imeAppWindowBecomesInvisible() {
testSpec.assertWm {
this.isAppWindowVisible(testApp)
.then()
.isAppWindowInvisible(testApp)
.then()
.isAppWindowInvisible(testApp)
}
}
@Presubmit
@Test
fun navBarLayerIsVisible() = testSpec.navBarLayerIsVisible()
@Presubmit
@Test
fun statusBarLayerIsVisible() = testSpec.navBarLayerIsVisible()
@Presubmit
@Test
fun entireScreenCovered() = testSpec.entireScreenCovered()
@Presubmit
@Test
fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()
@Presubmit
@Test
fun imeAppLayerBecomesInvisible() {
testSpec.assertLayers {
this.isVisible(testApp)
.then()
.isInvisible(testApp)
}
}
@Presubmit
@Test
fun navBarLayerRotatesAndScales() = testSpec.navBarLayerRotatesAndScales()
@FlakyTest(bugId = 206753786)
@Test
fun statusBarLayerRotatesScales() = testSpec.statusBarLayerRotatesScales()
@Presubmit
@Test
fun visibleLayersShownMoreThanOneConsecutiveEntry() {
testSpec.assertLayers {
this.visibleLayersShownMoreThanOneConsecutiveEntry(listOf(
ComponentMatcher.IME,
ComponentMatcher.SPLASH_SCREEN))
.then()
.isInvisible(testApp)
}
}

View File

@@ -16,8 +16,8 @@
package com.android.server.wm.flicker.ime
import android.app.Instrumentation
import android.platform.test.annotations.FlakyTest
import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit
import android.view.Surface
import android.view.WindowInsets.Type.ime
@@ -25,8 +25,7 @@ import android.view.WindowInsets.Type.navigationBars
import android.view.WindowInsets.Type.statusBars
import android.view.WindowManagerPolicyConstants
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.BaseTest
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
@@ -49,37 +48,95 @@ import org.junit.runners.Parameterized
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class LaunchAppShowImeAndDialogThemeAppTest(private val testSpec: FlickerTestParameter) {
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
class LaunchAppShowImeAndDialogThemeAppTest(
testSpec: FlickerTestParameter
) : BaseTest(testSpec) {
private val testApp = ImeAppAutoFocusHelper(instrumentation, testSpec.startRotation)
@FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply {
setup {
eachRun {
testApp.launchViaIntent(wmHelper)
wmHelper.StateSyncBuilder()
.withImeShown()
.waitForAndVerify()
testApp.startDialogThemedActivity(wmHelper)
// Verify IME insets isn't visible on dialog since it's non-IME focusable window
assertFalse(testApp.getInsetsVisibleFromDialog(ime()))
assertTrue(testApp.getInsetsVisibleFromDialog(statusBars()))
assertTrue(testApp.getInsetsVisibleFromDialog(navigationBars()))
}
}
teardown {
eachRun {
testApp.exit(wmHelper)
}
}
transitions {
testApp.dismissDialog(wmHelper)
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
eachRun {
testApp.launchViaIntent(wmHelper)
wmHelper.StateSyncBuilder()
.withImeShown()
.waitForAndVerify()
testApp.startDialogThemedActivity(wmHelper)
// Verify IME insets isn't visible on dialog since it's non-IME focusable window
assertFalse(testApp.getInsetsVisibleFromDialog(ime()))
assertTrue(testApp.getInsetsVisibleFromDialog(statusBars()))
assertTrue(testApp.getInsetsVisibleFromDialog(navigationBars()))
}
}
teardown {
eachRun {
testApp.exit(wmHelper)
}
}
transitions {
testApp.dismissDialog(wmHelper)
}
}
/** {@inheritDoc} */
@Postsubmit
@Test
override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun taskBarWindowIsAlwaysVisible() = super.taskBarWindowIsAlwaysVisible()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun statusBarWindowIsAlwaysVisible() = super.statusBarWindowIsAlwaysVisible()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun navBarLayerIsVisibleAtStartAndEnd() = super.navBarLayerIsVisibleAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun taskBarLayerIsVisibleAtStartAndEnd() = super.taskBarLayerIsVisibleAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun statusBarLayerIsVisibleAtStartAndEnd() =
super.statusBarLayerIsVisibleAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun statusBarLayerPositionAtStartAndEnd() =
super.statusBarLayerPositionAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
super.visibleLayersShownMoreThanOneConsecutiveEntry()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun entireScreenCovered() = super.entireScreenCovered()
/**
* Checks that [ComponentMatcher.IME] layer becomes visible during the transition
*/

View File

@@ -16,13 +16,12 @@
package com.android.server.wm.flicker.ime
import android.app.Instrumentation
import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit
import android.view.Surface
import android.view.WindowManagerPolicyConstants
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.BaseTest
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
@@ -69,35 +68,91 @@ import org.junit.runners.Parameterized
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class LaunchAppShowImeOnStartTest(private val testSpec: FlickerTestParameter) {
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
class LaunchAppShowImeOnStartTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
private val testApp = ImeAppAutoFocusHelper(instrumentation, testSpec.startRotation)
private val initializeApp = ImeStateInitializeHelper(instrumentation)
@FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply {
setup {
eachRun {
initializeApp.launchViaIntent(wmHelper)
this.setRotation(testSpec.startRotation)
}
}
teardown {
eachRun {
initializeApp.exit(wmHelper)
testApp.exit(wmHelper)
}
}
transitions {
testApp.launchViaIntent(wmHelper)
wmHelper.StateSyncBuilder()
.withImeShown()
.waitForAndVerify()
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
eachRun {
initializeApp.launchViaIntent(wmHelper)
this.setRotation(testSpec.startRotation)
}
}
teardown {
eachRun {
initializeApp.exit(wmHelper)
testApp.exit(wmHelper)
}
}
transitions {
testApp.launchViaIntent(wmHelper)
wmHelper.StateSyncBuilder()
.withImeShown()
.waitForAndVerify()
}
}
/** {@inheritDoc} */
@Postsubmit
@Test
override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun taskBarWindowIsAlwaysVisible() = super.taskBarWindowIsAlwaysVisible()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun statusBarWindowIsAlwaysVisible() = super.statusBarWindowIsAlwaysVisible()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun navBarLayerIsVisibleAtStartAndEnd() = super.navBarLayerIsVisibleAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun taskBarLayerIsVisibleAtStartAndEnd() = super.taskBarLayerIsVisibleAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun statusBarLayerIsVisibleAtStartAndEnd() =
super.statusBarLayerIsVisibleAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun statusBarLayerPositionAtStartAndEnd() =
super.statusBarLayerPositionAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
super.visibleLayersShownMoreThanOneConsecutiveEntry()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun entireScreenCovered() = super.entireScreenCovered()
/**
* Checks that [ComponentMatcher.IME] window becomes visible during the transition
*/

View File

@@ -16,25 +16,19 @@
package com.android.server.wm.flicker.ime
import android.app.Instrumentation
import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit
import android.view.Surface
import android.view.WindowManagerPolicyConstants
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.BaseTest
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.annotation.Group2
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.entireScreenCovered
import com.android.server.wm.flicker.helpers.ImeAppHelper
import com.android.server.wm.flicker.helpers.SimpleAppHelper
import com.android.server.wm.flicker.navBarLayerIsVisible
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarWindowIsVisible
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -52,88 +46,62 @@ import org.junit.runners.Parameterized
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group2
class OpenImeWindowAndCloseTest(private val testSpec: FlickerTestParameter) {
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
class OpenImeWindowAndCloseTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
private val simpleApp = SimpleAppHelper(instrumentation)
private val testApp = ImeAppHelper(instrumentation)
@FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply {
setup {
eachRun {
simpleApp.launchViaIntent(wmHelper)
testApp.launchViaIntent(wmHelper)
testApp.openIME(wmHelper)
}
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
eachRun {
simpleApp.launchViaIntent(wmHelper)
testApp.launchViaIntent(wmHelper)
testApp.openIME(wmHelper)
}
transitions {
testApp.finishActivity(wmHelper)
}
teardown {
test {
simpleApp.exit(wmHelper)
}
}
transitions {
testApp.finishActivity(wmHelper)
}
teardown {
test {
simpleApp.exit(wmHelper)
}
}
}
@Presubmit
/** {@inheritDoc} */
@Postsubmit
@Test
fun navBarWindowIsVisible() = testSpec.navBarWindowIsVisible()
override fun navBarLayerPositionAtStartAndEnd() =
super.navBarLayerPositionAtStartAndEnd()
@Presubmit
/** {@inheritDoc} */
@Postsubmit
@Test
fun statusBarWindowIsVisible() = testSpec.statusBarWindowIsVisible()
override fun statusBarLayerPositionAtStartAndEnd() =
super.statusBarLayerPositionAtStartAndEnd()
@Presubmit
@Test
fun imeWindowBecomesInvisible() = testSpec.imeWindowBecomesInvisible()
@Presubmit
@Test
fun navBarLayerIsVisible() = testSpec.navBarLayerIsVisible()
@Presubmit
@Test
fun statusBarLayerIsVisible() = testSpec.statusBarLayerIsVisible()
@Presubmit
@Test
fun entireScreenCovered() = testSpec.entireScreenCovered()
@Presubmit
@Test
fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()
@Presubmit
@Test
fun visibleLayersShownMoreThanOneConsecutiveEntry() {
testSpec.assertLayers {
this.visibleLayersShownMoreThanOneConsecutiveEntry()
}
}
@Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
testSpec.assertWm {
this.visibleWindowsShownMoreThanOneConsecutiveEntry()
}
}
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance()
.getConfigNonRotationTests(
repetitions = 3,
supportedRotations = listOf(Surface.ROTATION_0),
supportedNavigationModes = listOf(
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
)
.getConfigNonRotationTests(
repetitions = 3,
supportedRotations = listOf(Surface.ROTATION_0),
supportedNavigationModes = listOf(
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
)
)
}
}
}

View File

@@ -16,16 +16,13 @@
package com.android.server.wm.flicker.ime
import android.app.Instrumentation
import android.platform.test.annotations.FlakyTest
import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit
import android.platform.test.annotations.RequiresDevice
import android.view.Surface
import android.view.WindowManagerPolicyConstants
import androidx.test.platform.app.InstrumentationRegistry
import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.BaseTest
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
@@ -33,11 +30,7 @@ import com.android.server.wm.flicker.annotation.Group2
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.navBarLayerPositionEnd
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.snapshotStartingWindowLayerCoversExactlyOnApp
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -54,59 +47,86 @@ import org.junit.runners.Parameterized
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group2
class OpenImeWindowFromFixedOrientationAppTest(private val testSpec: FlickerTestParameter) {
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
class OpenImeWindowFromFixedOrientationAppTest(
testSpec: FlickerTestParameter
) : BaseTest(testSpec) {
private val imeTestApp = ImeAppAutoFocusHelper(instrumentation, testSpec.startRotation)
private val taplInstrumentation = LauncherInstrumentation()
@FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply {
setup {
test {
// Launch the activity with expecting IME will be shown.
imeTestApp.launchViaIntent(wmHelper)
}
eachRun {
// Swiping out the IME activity to home.
taplInstrumentation.goHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.waitForAndVerify()
}
}
transitions {
// Bring the exist IME activity to the front in landscape mode device rotation.
setRotation(Surface.ROTATION_90)
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
test {
// Launch the activity with expecting IME will be shown.
imeTestApp.launchViaIntent(wmHelper)
}
teardown {
test {
imeTestApp.exit(wmHelper)
}
eachRun {
// Swiping out the IME activity to home.
device.pressHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.waitForAndVerify()
}
}
transitions {
// Bring the exist IME activity to the front in landscape mode device rotation.
setRotation(Surface.ROTATION_90)
imeTestApp.launchViaIntent(wmHelper)
}
teardown {
test {
imeTestApp.exit(wmHelper)
}
}
}
@Presubmit
/** {@inheritDoc} */
@FlakyTest(bugId = 206753786)
@Test
fun navBarWindowIsVisible() = testSpec.navBarWindowIsVisible()
override fun statusBarLayerPositionAtStartAndEnd() =
super.statusBarLayerPositionAtStartAndEnd()
@Presubmit
/** {@inheritDoc} */
@Postsubmit
@Test
fun statusBarWindowIsVisible() = testSpec.statusBarWindowIsVisible()
override fun entireScreenCovered() = super.entireScreenCovered()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun statusBarLayerIsVisibleAtStartAndEnd() =
super.statusBarLayerIsVisibleAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun navBarLayerIsVisibleAtStartAndEnd() = super.navBarLayerIsVisibleAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun taskBarLayerIsVisibleAtStartAndEnd() = super.taskBarLayerIsVisibleAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
super.visibleLayersShownMoreThanOneConsecutiveEntry()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
@Presubmit
@Test
fun imeWindowBecomesVisible() = testSpec.imeWindowBecomesVisible()
@Presubmit
@Test
fun navBarLayerRotatesAndScales() = testSpec.navBarLayerPositionEnd()
@FlakyTest(bugId = 206753786)
fun statusBarLayerRotatesScales() = testSpec.statusBarLayerRotatesScales()
@Presubmit
@Test
fun imeLayerBecomesVisible() = testSpec.imeLayerBecomesVisible()
@@ -128,13 +148,13 @@ class OpenImeWindowFromFixedOrientationAppTest(private val testSpec: FlickerTest
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance()
.getConfigNonRotationTests(
repetitions = 3,
supportedRotations = listOf(Surface.ROTATION_90),
supportedNavigationModes = listOf(
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
)
.getConfigNonRotationTests(
repetitions = 3,
supportedRotations = listOf(Surface.ROTATION_90),
supportedNavigationModes = listOf(
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
)
)
}
}
}

View File

@@ -16,27 +16,18 @@
package com.android.server.wm.flicker.ime
import android.app.Instrumentation
import android.platform.test.annotations.FlakyTest
import android.platform.test.annotations.Presubmit
import android.view.Surface
import android.view.WindowManagerPolicyConstants
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.BaseTest
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.annotation.Group2
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.entireScreenCovered
import com.android.server.wm.flicker.helpers.ImeAppHelper
import com.android.server.wm.flicker.navBarLayerIsVisible
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -52,39 +43,34 @@ import org.junit.runners.Parameterized
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group2
class OpenImeWindowTest(private val testSpec: FlickerTestParameter) {
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
class OpenImeWindowTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
private val testApp = ImeAppHelper(instrumentation)
@FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply {
setup {
test {
testApp.launchViaIntent(wmHelper)
}
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
test {
testApp.launchViaIntent(wmHelper)
}
transitions {
testApp.openIME(wmHelper)
}
transitions {
testApp.openIME(wmHelper)
}
teardown {
eachRun {
testApp.closeIME(wmHelper)
}
teardown {
eachRun {
testApp.closeIME(wmHelper)
}
test {
testApp.exit(wmHelper)
}
test {
testApp.exit(wmHelper)
}
}
}
@Presubmit
/** {@inheritDoc} */
@FlakyTest(bugId = 206753786)
@Test
fun navBarWindowIsVisible() = testSpec.navBarWindowIsVisible()
@Presubmit
@Test
fun statusBarWindowIsVisible() = testSpec.statusBarWindowIsVisible()
override fun statusBarLayerPositionAtStartAndEnd() =
super.statusBarLayerPositionAtStartAndEnd()
@Presubmit
@Test
@@ -98,18 +84,6 @@ class OpenImeWindowTest(private val testSpec: FlickerTestParameter) {
}
}
@Presubmit
@Test
fun navBarLayerIsVisible() = testSpec.navBarLayerIsVisible()
@Presubmit
@Test
fun statusBarLayerIsVisible() = testSpec.statusBarLayerIsVisible()
@Presubmit
@Test
fun entireScreenCovered() = testSpec.entireScreenCovered()
@Presubmit
@Test
fun imeLayerBecomesVisible() = testSpec.imeLayerBecomesVisible()
@@ -122,30 +96,6 @@ class OpenImeWindowTest(private val testSpec: FlickerTestParameter) {
}
}
@Presubmit
@Test
fun navBarLayerRotatesAndScales() = testSpec.navBarLayerRotatesAndScales()
@FlakyTest(bugId = 206753786)
@Test
fun statusBarLayerRotatesScales() = testSpec.statusBarLayerRotatesScales()
@Presubmit
@Test
fun visibleLayersShownMoreThanOneConsecutiveEntry() {
testSpec.assertLayers {
this.visibleLayersShownMoreThanOneConsecutiveEntry()
}
}
@Presubmit
@Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
testSpec.assertWm {
this.visibleWindowsShownMoreThanOneConsecutiveEntry()
}
}
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic

View File

@@ -16,15 +16,13 @@
package com.android.server.wm.flicker.ime
import android.app.Instrumentation
import android.platform.test.annotations.FlakyTest
import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit
import android.platform.test.annotations.RequiresDevice
import android.view.Surface
import android.view.WindowManagerPolicyConstants
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.BaseTest
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
@@ -32,16 +30,14 @@ import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper
import com.android.server.wm.flicker.helpers.isShellTransitionsEnabled
import com.android.server.wm.flicker.navBarLayerIsVisible
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.flicker.navBarLayerIsVisibleAtStartAndEnd
import com.android.server.wm.flicker.statusBarLayerIsVisibleAtStartAndEnd
import com.android.server.wm.traces.common.ComponentMatcher
import com.android.server.wm.traces.common.WindowManagerConditionsFactory
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import org.junit.Assume.assumeFalse
import org.junit.Assume.assumeTrue
import org.junit.Assume
import org.junit.FixMethodOrder
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
@@ -56,44 +52,39 @@ import org.junit.runners.Parameterized
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group4
class OpenImeWindowToOverViewTest(private val testSpec: FlickerTestParameter) {
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
class OpenImeWindowToOverViewTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
private val imeTestApp = ImeAppAutoFocusHelper(instrumentation, testSpec.startRotation)
private val statusBarInvisible = WindowManagerConditionsFactory.isStatusBarVisible().negate()
private val navBarInvisible = WindowManagerConditionsFactory.isNavBarVisible().negate()
@FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply {
setup {
eachRun {
imeTestApp.launchViaIntent(wmHelper)
}
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
eachRun {
imeTestApp.launchViaIntent(wmHelper)
}
transitions {
device.pressRecentApps()
val builder = wmHelper.StateSyncBuilder()
.withRecentsActivityVisible()
waitNavStatusBarVisibility(builder)
builder.waitForAndVerify()
}
teardown {
test {
device.pressHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.waitForAndVerify()
imeTestApp.exit(wmHelper)
}
}
transitions {
device.pressRecentApps()
val builder = wmHelper.StateSyncBuilder()
.withRecentsActivityVisible()
waitNavStatusBarVisibility(builder)
builder.waitForAndVerify()
}
teardown {
test {
device.pressHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.waitForAndVerify()
imeTestApp.exit(wmHelper)
}
}
}
/**
* The bars (including status bar and navigation bar) are expected to be hidden while
* entering overview in landscape if launcher is set to portrait only. Because
* "showing portrait overview (launcher) in landscape display" is an intermediate state
* depending on the touch-up to decide the intention of gesture, the display may keep in
* The bars (including [ComponentMatcher.STATUS_BAR] and [ComponentMatcher.NAV_BAR]) are
* expected to be hidden while entering overview in landscape if launcher is set to portrait
* only. Because "showing portrait overview (launcher) in landscape display" is an intermediate
* state depending on the touch-up to decide the intention of gesture, the display may keep in
* landscape if return to app, or change to portrait if the gesture is to swipe-to-home.
*
* So instead of showing landscape bars with portrait launcher at the same time
@@ -104,20 +95,28 @@ class OpenImeWindowToOverViewTest(private val testSpec: FlickerTestParameter) {
*/
private fun waitNavStatusBarVisibility(stateSync: WindowManagerStateHelper.StateSyncBuilder) {
when {
testSpec.isLandscapeOrSeascapeAtStart ->
stateSync.add(statusBarInvisible)
testSpec.isLandscapeOrSeascapeAtStart && !testSpec.isTablet ->
stateSync.add(WindowManagerConditionsFactory.isStatusBarVisible().negate())
else ->
stateSync.withNavBarStatusBarVisible()
stateSync.withNavOrTaskBarVisible().withStatusBarVisible()
}
}
@Presubmit
/** {@inheritDoc} */
@Postsubmit
@Test
fun navBarWindowIsVisible() = testSpec.navBarWindowIsVisible()
override fun entireScreenCovered() = super.entireScreenCovered()
@Presubmit
/** {@inheritDoc} */
@Postsubmit
@Test
fun statusBarWindowIsVisible() = testSpec.statusBarWindowIsVisible()
override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
super.visibleLayersShownMoreThanOneConsecutiveEntry()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
@Presubmit
@Test
@@ -127,9 +126,10 @@ class OpenImeWindowToOverViewTest(private val testSpec: FlickerTestParameter) {
@Presubmit
@Test
fun navBarLayerIsVisible3Button() {
assumeFalse(testSpec.isGesturalNavigation)
testSpec.navBarLayerIsVisible()
fun navBarLayerIsVisibleAtStartAndEnd3Button() {
Assume.assumeFalse(testSpec.isTablet)
Assume.assumeFalse(testSpec.isGesturalNavigation)
testSpec.navBarLayerIsVisibleAtStartAndEnd()
}
/**
@@ -137,10 +137,11 @@ class OpenImeWindowToOverViewTest(private val testSpec: FlickerTestParameter) {
*/
@Presubmit
@Test
fun navBarLayerIsVisibleInPortraitGestural() {
assumeFalse(testSpec.isLandscapeOrSeascapeAtStart)
assumeTrue(testSpec.isGesturalNavigation)
testSpec.navBarLayerIsVisible()
fun navBarLayerIsVisibleAtStartAndEndGestural() {
Assume.assumeFalse(testSpec.isTablet)
Assume.assumeTrue(testSpec.isGesturalNavigation)
Assume.assumeFalse(isShellTransitionsEnabled)
testSpec.navBarLayerIsVisibleAtStartAndEnd()
}
/**
@@ -150,9 +151,9 @@ class OpenImeWindowToOverViewTest(private val testSpec: FlickerTestParameter) {
@Postsubmit
@Test
fun navBarLayerIsInvisibleInLandscapeGestural() {
assumeTrue(testSpec.isLandscapeOrSeascapeAtStart)
assumeTrue(testSpec.isGesturalNavigation)
assumeTrue(isShellTransitionsEnabled)
Assume.assumeTrue(testSpec.isLandscapeOrSeascapeAtStart)
Assume.assumeTrue(testSpec.isGesturalNavigation)
Assume.assumeTrue(isShellTransitionsEnabled)
testSpec.assertLayersStart {
this.isVisible(ComponentMatcher.NAV_BAR)
}
@@ -161,17 +162,16 @@ class OpenImeWindowToOverViewTest(private val testSpec: FlickerTestParameter) {
}
}
@Postsubmit
@Test
fun statusBarLayerIsVisibleInPortrait() {
assumeFalse(testSpec.isLandscapeOrSeascapeAtStart)
testSpec.statusBarLayerIsVisible()
}
/**
* In the legacy transitions, the nav bar is not marked as invisible.
* In the new transitions this is fixed and the nav bar shows as invisible
*/
@Presubmit
@Test
fun statusBarLayerIsInvisibleInLandscape() {
assumeTrue(testSpec.isLandscapeOrSeascapeAtStart)
fun statusBarLayerIsInvisibleInLandscapePhone() {
Assume.assumeTrue(testSpec.isLandscapeOrSeascapeAtStart)
Assume.assumeTrue(testSpec.isGesturalNavigation)
Assume.assumeFalse(testSpec.isTablet)
testSpec.assertLayersStart {
this.isVisible(ComponentMatcher.STATUS_BAR)
}
@@ -180,13 +180,79 @@ class OpenImeWindowToOverViewTest(private val testSpec: FlickerTestParameter) {
}
}
/**
* In the legacy transitions, the nav bar is not marked as invisible.
* In the new transitions this is fixed and the nav bar shows as invisible
*/
@Presubmit
@Test
fun statusBarLayerIsInvisibleInLandscapeTablet() {
Assume.assumeTrue(testSpec.isLandscapeOrSeascapeAtStart)
Assume.assumeTrue(testSpec.isGesturalNavigation)
Assume.assumeTrue(testSpec.isTablet)
testSpec.statusBarLayerIsVisibleAtStartAndEnd()
}
/** {@inheritDoc} */
@Ignore("Visibility changes depending on orientation and navigation mode")
override fun navBarLayerIsVisibleAtStartAndEnd() { }
/** {@inheritDoc} */
@Ignore("Visibility changes depending on orientation and navigation mode")
override fun navBarLayerPositionAtStartAndEnd() { }
/** {@inheritDoc} */
@Ignore("Visibility changes depending on orientation and navigation mode")
override fun statusBarLayerPositionAtStartAndEnd() { }
/** {@inheritDoc} */
@Ignore("Visibility changes depending on orientation and navigation mode")
override fun statusBarLayerIsVisibleAtStartAndEnd() { }
@Postsubmit
@Test
override fun taskBarLayerIsVisibleAtStartAndEnd() =
super.taskBarLayerIsVisibleAtStartAndEnd()
@Postsubmit
@Test
fun statusBarLayerIsVisibleInPortrait() {
Assume.assumeFalse(testSpec.isLandscapeOrSeascapeAtStart)
testSpec.statusBarLayerIsVisibleAtStartAndEnd()
}
@Presubmit
@Test
fun statusBarLayerIsInvisibleInLandscapeShell() {
Assume.assumeTrue(testSpec.isLandscapeOrSeascapeAtStart)
Assume.assumeFalse(testSpec.isTablet)
Assume.assumeTrue(isShellTransitionsEnabled)
testSpec.assertLayersStart {
this.isVisible(ComponentMatcher.STATUS_BAR)
}
testSpec.assertLayersEnd {
this.isInvisible(ComponentMatcher.STATUS_BAR)
}
}
@Presubmit
@Test
fun statusBarLayerIsVisibleInLandscapeLegacy() {
Assume.assumeTrue(testSpec.isLandscapeOrSeascapeAtStart)
Assume.assumeTrue(testSpec.isTablet)
Assume.assumeFalse(isShellTransitionsEnabled)
testSpec.statusBarLayerIsVisibleAtStartAndEnd()
}
@FlakyTest(bugId = 228011606)
@Test
fun imeLayerIsVisibleAndAssociatedWithAppWidow() {
testSpec.assertLayersStart {
isVisible(ComponentMatcher.IME).visibleRegion(ComponentMatcher.IME)
.coversAtMost(isVisible(imeTestApp)
.visibleRegion(imeTestApp).region)
.coversAtMost(
isVisible(imeTestApp)
.visibleRegion(imeTestApp).region
)
}
testSpec.assertLayers {
this.invoke("imeLayerIsVisibleAndAlignAppWidow") {
@@ -211,14 +277,14 @@ class OpenImeWindowToOverViewTest(private val testSpec: FlickerTestParameter) {
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance()
.getConfigNonRotationTests(
repetitions = 1,
supportedRotations = listOf(Surface.ROTATION_0, Surface.ROTATION_90),
supportedNavigationModes = listOf(
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
)
.getConfigNonRotationTests(
repetitions = 1,
supportedRotations = listOf(Surface.ROTATION_0, Surface.ROTATION_90),
supportedNavigationModes = listOf(
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
)
)
}
}
}

View File

@@ -16,33 +16,23 @@
package com.android.server.wm.flicker.ime
import android.app.Instrumentation
import android.platform.test.annotations.FlakyTest
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.BaseTest
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.annotation.Group2
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.entireScreenCovered
import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper
import com.android.server.wm.flicker.helpers.isShellTransitionsEnabled
import com.android.server.wm.flicker.helpers.reopenAppFromOverview
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.navBarLayerIsVisible
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.ComponentMatcher
import com.android.server.wm.traces.common.ComponentMatcher.Companion.LAUNCHER
import org.junit.Assume.assumeFalse
import org.junit.Assume.assumeTrue
import org.junit.Assume
import org.junit.Before
import org.junit.FixMethodOrder
import org.junit.Test
@@ -59,56 +49,67 @@ import org.junit.runners.Parameterized
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group2
open class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
open class ReOpenImeWindowTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
private val testApp = ImeAppAutoFocusHelper(instrumentation, testSpec.startRotation)
@Before
open fun before() {
assumeFalse(isShellTransitionsEnabled)
Assume.assumeFalse(isShellTransitionsEnabled)
}
@FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply {
setup {
test {
testApp.launchViaIntent(wmHelper)
testApp.openIME(wmHelper)
}
eachRun {
this.setRotation(testSpec.startRotation)
device.pressRecentApps()
wmHelper.StateSyncBuilder()
.withRecentsActivityVisible()
.waitForAndVerify()
}
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
test {
testApp.launchViaIntent(wmHelper)
testApp.openIME(wmHelper)
}
transitions {
device.reopenAppFromOverview(wmHelper)
eachRun {
this.setRotation(testSpec.startRotation)
device.pressRecentApps()
wmHelper.StateSyncBuilder()
.withImeShown()
.withRecentsActivityVisible()
.waitForAndVerify()
}
teardown {
test {
testApp.exit(wmHelper)
}
}
transitions {
device.reopenAppFromOverview(wmHelper)
wmHelper.StateSyncBuilder()
.withImeShown()
.waitForAndVerify()
}
teardown {
test {
testApp.exit(wmHelper)
}
}
}
@Presubmit
/** {@inheritDoc} */
@FlakyTest(bugId = 206753786)
@Test
fun navBarWindowIsVisible() = testSpec.navBarWindowIsVisible()
override fun statusBarLayerPositionAtStartAndEnd() =
super.statusBarLayerPositionAtStartAndEnd()
/** {@inheritDoc} */
@Presubmit
@Test
fun statusBarWindowIsVisible() = testSpec.statusBarWindowIsVisible()
override fun visibleLayersShownMoreThanOneConsecutiveEntry() {
// depends on how much of the animation transactions are sent to SF at once
// sometimes this layer appears for 2-3 frames, sometimes for only 1
val recentTaskComponent = ComponentMatcher("", "RecentTaskScreenshotSurface")
testSpec.assertLayers {
this.visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(ComponentMatcher.SPLASH_SCREEN,
ComponentMatcher.SNAPSHOT, recentTaskComponent)
)
}
}
/** {@inheritDoc} */
@Presubmit
@Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
val component = ComponentMatcher("", "RecentTaskScreenshotSurface")
testSpec.assertWm {
this.visibleWindowsShownMoreThanOneConsecutiveEntry(
@@ -136,7 +137,7 @@ open class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
@Presubmit
@Test
fun imeAppWindowVisibilityLegacy() {
assumeFalse(isShellTransitionsEnabled)
Assume.assumeFalse(isShellTransitionsEnabled)
// the app starts visible in live tile, and stays visible for the duration of entering
// and exiting overview. However, legacy transitions seem to have a bug which causes
// everything to restart during the test, so expect the app to disappear and come back.
@@ -154,7 +155,7 @@ open class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
@FlakyTest(bugId = 204570898)
@Test
fun imeAppWindowVisibility() {
assumeTrue(isShellTransitionsEnabled)
Assume.assumeTrue(isShellTransitionsEnabled)
// the app starts visible in live tile, and stays visible for the duration of entering
// and exiting overview. Since we log 1x per frame, sometimes the activity visibility
// and the app visibility are updated together, sometimes not, thus ignore activity
@@ -164,23 +165,10 @@ open class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
}
}
@Presubmit
@Test
// During testing the launcher is always in portrait mode
fun entireScreenCovered() = testSpec.entireScreenCovered()
@Presubmit
@Test
fun navBarLayerIsVisible() = testSpec.navBarLayerIsVisible()
@Presubmit
@Test
fun statusBarLayerIsVisible() = testSpec.statusBarLayerIsVisible()
@Presubmit
@Test
fun imeLayerIsBecomesVisibleLegacy() {
assumeFalse(isShellTransitionsEnabled)
Assume.assumeFalse(isShellTransitionsEnabled)
testSpec.assertLayers {
this.isVisible(ComponentMatcher.IME)
.then()
@@ -193,7 +181,7 @@ open class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
@FlakyTest(bugId = 204570898)
@Test
fun imeLayerIsBecomesVisible() {
assumeTrue(isShellTransitionsEnabled)
Assume.assumeTrue(isShellTransitionsEnabled)
testSpec.assertLayers {
this.isVisible(ComponentMatcher.IME)
}
@@ -211,28 +199,6 @@ open class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
}
}
@Presubmit
@Test
fun navBarLayerRotatesAndScales() = testSpec.navBarLayerRotatesAndScales()
@FlakyTest(bugId = 206753786)
@Test
fun statusBarLayerRotatesScales() = testSpec.statusBarLayerRotatesScales()
@Presubmit
@Test
fun visibleLayersShownMoreThanOneConsecutiveEntry() {
// depends on how much of the animation transactions are sent to SF at once
// sometimes this layer appears for 2-3 frames, sometimes for only 1
val recentTaskComponent = ComponentMatcher("", "RecentTaskScreenshotSurface")
testSpec.assertLayers {
this.visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(ComponentMatcher.SPLASH_SCREEN,
ComponentMatcher.SNAPSHOT, recentTaskComponent)
)
}
}
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic

View File

@@ -39,8 +39,9 @@ import org.junit.runners.Parameterized
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group2
@FlakyTest(bugId = 221854428)
class ReOpenImeWindowTest_ShellTransit(private val testSpec: FlickerTestParameter)
: ReOpenImeWindowTest(testSpec) {
class ReOpenImeWindowTest_ShellTransit(
testSpec: FlickerTestParameter
) : ReOpenImeWindowTest(testSpec) {
@Before
override fun before() {
Assume.assumeTrue(isShellTransitionsEnabled)

View File

@@ -16,13 +16,12 @@
package com.android.server.wm.flicker.ime
import android.app.Instrumentation
import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit
import android.view.Surface
import android.view.WindowManagerPolicyConstants
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.BaseTest
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
@@ -33,8 +32,6 @@ import com.android.server.wm.flicker.helpers.SimpleAppHelper
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.helpers.isShellTransitionsEnabled
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.Assume
import org.junit.Before
@@ -54,8 +51,9 @@ import org.junit.runners.Parameterized
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group4
@Presubmit
open class SwitchImeWindowsFromGestureNavTest(private val testSpec: FlickerTestParameter) {
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
open class SwitchImeWindowsFromGestureNavTest(
testSpec: FlickerTestParameter
) : BaseTest(testSpec) {
private val testApp = SimpleAppHelper(instrumentation)
private val imeTestApp = ImeAppAutoFocusHelper(instrumentation, testSpec.startRotation)
@@ -64,59 +62,110 @@ open class SwitchImeWindowsFromGestureNavTest(private val testSpec: FlickerTestP
Assume.assumeFalse(isShellTransitionsEnabled)
}
@FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply {
setup {
eachRun {
this.setRotation(testSpec.startRotation)
testApp.launchViaIntent(wmHelper)
wmHelper.StateSyncBuilder()
.withFullScreenApp(testApp)
.waitForAndVerify()
imeTestApp.launchViaIntent(wmHelper)
wmHelper.StateSyncBuilder()
.withFullScreenApp(imeTestApp)
.waitForAndVerify()
imeTestApp.openIME(wmHelper)
}
}
teardown {
eachRun {
device.pressHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.waitForAndVerify()
testApp.exit(wmHelper)
imeTestApp.exit(wmHelper)
}
}
transitions {
// [Step1]: Swipe right from imeTestApp to testApp task
createTag(TAG_IME_VISIBLE)
val displayBounds = WindowUtils.getDisplayBounds(testSpec.startRotation)
device.swipe(0, displayBounds.bounds.height,
displayBounds.bounds.width, displayBounds.bounds.height, 50)
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
eachRun {
this.setRotation(testSpec.startRotation)
testApp.launchViaIntent(wmHelper)
wmHelper.StateSyncBuilder()
.withFullScreenApp(testApp)
.waitForAndVerify()
createTag(TAG_IME_INVISIBLE)
}
transitions {
// [Step2]: Swipe left to back to imeTestApp task
val displayBounds = WindowUtils.getDisplayBounds(testSpec.startRotation)
device.swipe(displayBounds.bounds.width, displayBounds.bounds.height,
0, displayBounds.bounds.height, 50)
imeTestApp.launchViaIntent(wmHelper)
wmHelper.StateSyncBuilder()
.withFullScreenApp(imeTestApp)
.waitForAndVerify()
imeTestApp.openIME(wmHelper)
}
}
teardown {
eachRun {
device.pressHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.waitForAndVerify()
testApp.exit(wmHelper)
imeTestApp.exit(wmHelper)
}
}
transitions {
// [Step1]: Swipe right from imeTestApp to testApp task
createTag(TAG_IME_VISIBLE)
val displayBounds = WindowUtils.getDisplayBounds(testSpec.startRotation)
device.swipe(
0, displayBounds.bounds.height,
displayBounds.bounds.width, displayBounds.bounds.height, 50
)
wmHelper.StateSyncBuilder()
.withFullScreenApp(testApp)
.waitForAndVerify()
createTag(TAG_IME_INVISIBLE)
}
transitions {
// [Step2]: Swipe left to back to imeTestApp task
val displayBounds = WindowUtils.getDisplayBounds(testSpec.startRotation)
device.swipe(
displayBounds.bounds.width, displayBounds.bounds.height,
0, displayBounds.bounds.height, 50
)
wmHelper.StateSyncBuilder()
.withFullScreenApp(imeTestApp)
.waitForAndVerify()
}
}
/** {@inheritDoc} */
@Postsubmit
@Test
override fun statusBarWindowIsAlwaysVisible() = super.statusBarWindowIsAlwaysVisible()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun entireScreenCovered() = super.entireScreenCovered()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun statusBarLayerIsVisibleAtStartAndEnd() =
super.statusBarLayerIsVisibleAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun navBarLayerIsVisibleAtStartAndEnd() = super.navBarLayerIsVisibleAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun taskBarLayerIsVisibleAtStartAndEnd() = super.taskBarLayerIsVisibleAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun statusBarLayerPositionAtStartAndEnd() =
super.statusBarLayerPositionAtStartAndEnd()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
super.visibleLayersShownMoreThanOneConsecutiveEntry()
/** {@inheritDoc} */
@Postsubmit
@Test
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
@Test
fun imeAppWindowVisibility() {
testSpec.assertWm {
@@ -132,26 +181,6 @@ open class SwitchImeWindowsFromGestureNavTest(private val testSpec: FlickerTestP
}
}
@Test
fun navBarLayerIsVisibleAroundSwitching() {
testSpec.assertLayersStart {
isVisible(ComponentMatcher.NAV_BAR)
}
testSpec.assertLayersEnd {
isVisible(ComponentMatcher.NAV_BAR)
}
}
@Test
fun statusBarLayerIsVisibleAroundSwitching() {
testSpec.assertLayersStart {
isVisible(ComponentMatcher.STATUS_BAR)
}
testSpec.assertLayersEnd {
isVisible(ComponentMatcher.STATUS_BAR)
}
}
@Test
fun imeLayerIsVisibleWhenSwitchingToImeApp() {
testSpec.assertLayersStart {
@@ -172,24 +201,18 @@ open class SwitchImeWindowsFromGestureNavTest(private val testSpec: FlickerTestP
}
}
@Test
fun navBarWindowIsVisible() = testSpec.navBarWindowIsVisible()
@Test
fun statusBarWindowIsVisible() = testSpec.statusBarWindowIsVisible()
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance()
.getConfigNonRotationTests(
repetitions = 3,
supportedNavigationModes = listOf(
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
),
supportedRotations = listOf(Surface.ROTATION_0)
)
.getConfigNonRotationTests(
repetitions = 3,
supportedNavigationModes = listOf(
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
),
supportedRotations = listOf(Surface.ROTATION_0)
)
}
private const val TAG_IME_VISIBLE = "imeVisible"

View File

@@ -24,7 +24,6 @@ import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.helpers.isShellTransitionsEnabled
import org.junit.Assume
import org.junit.Before
import org.junit.FixMethodOrder
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
@@ -40,8 +39,9 @@ import org.junit.runners.Parameterized
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group4
@FlakyTest(bugId = 228012334)
class SwitchImeWindowsFromGestureNavTest_ShellTransit(testSpec: FlickerTestParameter)
: SwitchImeWindowsFromGestureNavTest(testSpec) {
class SwitchImeWindowsFromGestureNavTest_ShellTransit(
testSpec: FlickerTestParameter
) : SwitchImeWindowsFromGestureNavTest(testSpec) {
@Before
override fun before() {
Assume.assumeTrue(isShellTransitionsEnabled)