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

Commit 6dbb226d authored by Nataniel Borges's avatar Nataniel Borges
Browse files

Fix status bar assertions on seamless rotation

Status bar should not be visible because the app layer in seamless rotation is in full screen.

Also, add checks to ensure: app window is always full screen and app window is always set to seamless

Also: refactor rotation test assertions:
   - base class, all assertions in presubmit
   - child classes, override if need flaky or postsubmit

Bug: 186115871
Bug: 190350376
Test: atest FlickerTests:com.android.server.wm.flicker.rotation
Change-Id: I31f9c41ad6a8c0048a8f8a353c7e468afda1fc8e
parent f420024b
Loading
Loading
Loading
Loading
+34 −4
Original line number Diff line number Diff line
@@ -25,7 +25,12 @@ import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group3
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.endRotation
import com.android.server.wm.flicker.helpers.SimpleAppHelper
import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -73,10 +78,23 @@ class ChangeAppRotationTest(
        }
    }

    @Presubmit
    @Test
    fun statusBarWindowIsAlwaysVisible() {
        testSpec.statusBarWindowIsAlwaysVisible()
    }

    @FlakyTest
    @Test
    fun statusBarLayerIsAlwaysVisible() {
        testSpec.statusBarLayerIsAlwaysVisible(rotatesScreen = true)
    }

    @Postsubmit
    @Test
    override fun statusBarLayerRotatesScales() {
        super.statusBarLayerRotatesScales()
    fun statusBarLayerRotatesScales() {
        testSpec.statusBarLayerRotatesScales(
            testSpec.config.startRotation, testSpec.config.endRotation)
    }

    @Presubmit
@@ -87,8 +105,20 @@ class ChangeAppRotationTest(

    @FlakyTest
    @Test
    override fun statusBarLayerIsAlwaysVisible() {
        super.statusBarLayerIsAlwaysVisible()
    override fun navBarLayerIsAlwaysVisible() {
        super.navBarLayerIsAlwaysVisible()
    }

    @FlakyTest
    @Test
    override fun navBarLayerRotatesAndScales() {
        super.navBarLayerRotatesAndScales()
    }

    @FlakyTest
    @Test
    override fun visibleLayersShownMoreThanOneConsecutiveEntry() {
        super.visibleLayersShownMoreThanOneConsecutiveEntry()
    }

    companion object {
+3 −26
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.server.wm.flicker.rotation

import android.app.Instrumentation
import android.platform.test.annotations.Presubmit
import androidx.test.filters.FlakyTest
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.FlickerTestParameter
@@ -33,9 +32,6 @@ import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
import com.android.server.wm.flicker.noUncoveredRegions
import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import org.junit.Test

@@ -69,19 +65,19 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter)
        }
    }

    @FlakyTest
    @Presubmit
    @Test
    open fun navBarWindowIsAlwaysVisible() {
        testSpec.navBarWindowIsAlwaysVisible()
    }

    @FlakyTest
    @Presubmit
    @Test
    open fun navBarLayerIsAlwaysVisible() {
        testSpec.navBarLayerIsAlwaysVisible(rotatesScreen = true)
    }

    @FlakyTest
    @Presubmit
    @Test
    open fun navBarLayerRotatesAndScales() {
        testSpec.navBarLayerRotatesAndScales(
@@ -90,25 +86,6 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter)

    @Presubmit
    @Test
    open fun statusBarWindowIsAlwaysVisible() {
        testSpec.statusBarWindowIsAlwaysVisible()
    }

    @FlakyTest
    @Test
    open fun statusBarLayerIsAlwaysVisible() {
        testSpec.statusBarLayerIsAlwaysVisible(rotatesScreen = true)
    }

    @FlakyTest
    @Test
    open fun statusBarLayerRotatesScales() {
        testSpec.statusBarLayerRotatesScales(
            testSpec.config.startRotation, testSpec.config.endRotation)
    }

    @FlakyTest
    @Test
    open fun visibleLayersShownMoreThanOneConsecutiveEntry() {
        testSpec.assertLayers {
            this.visibleLayersShownMoreThanOneConsecutiveEntry(
+59 −6
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.server.wm.flicker.rotation

import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit
import android.view.WindowManager
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
@@ -27,6 +28,7 @@ import com.android.server.wm.flicker.annotation.Group3
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.SeamlessRotationAppHelper
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -60,16 +62,33 @@ class SeamlessAppRotationTest(
            }
        }

    @FlakyTest(bugId = 140855415)
    @Postsubmit
    @Test
    override fun statusBarWindowIsAlwaysVisible() {
        super.statusBarWindowIsAlwaysVisible()
    fun appWindowFullScreen() {
        testSpec.assertWm {
            this.invoke("isFullScreen") {
                val appWindow = it.windowState(testApp.`package`)
                val flags = appWindow.windowState?.attributes?.flags ?: 0
                appWindow.verify("isFullScreen")
                    .that(flags.and(WindowManager.LayoutParams.FLAG_FULLSCREEN))
                    .isGreaterThan(0)
            }
        }
    }

    @FlakyTest(bugId = 140855415)
    @Postsubmit
    @Test
    override fun statusBarLayerIsAlwaysVisible() {
        super.statusBarLayerIsAlwaysVisible()
    fun appWindowSeamlessRotation() {
        testSpec.assertWm {
            this.invoke("isRotationSeamless") {
                val appWindow = it.windowState(testApp.`package`)
                val rotationAnimation = appWindow.windowState?.attributes?.rotationAnimation ?: 0
                appWindow.verify("isRotationSeamless")
                    .that(rotationAnimation
                        .and(WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS))
                    .isGreaterThan(0)
            }
        }
    }

    @Presubmit
@@ -90,12 +109,46 @@ class SeamlessAppRotationTest(
        }
    }

    @Presubmit
    @Test
    fun statusBarWindowIsAlwaysInvisible() {
        testSpec.assertWm {
            this.hidesAboveAppWindow(WindowManagerStateHelper.STATUS_BAR_WINDOW_NAME)
        }
    }

    @Presubmit
    @Test
    fun statusBarLayerIsAlwaysInvisible() {
        testSpec.assertLayers {
            this.isInvisible(WindowManagerStateHelper.STATUS_BAR_LAYER_NAME)
        }
    }

    @Postsubmit
    @Test
    override fun visibleLayersShownMoreThanOneConsecutiveEntry() {
        super.visibleLayersShownMoreThanOneConsecutiveEntry()
    }

    @FlakyTest
    @Test
    override fun navBarWindowIsAlwaysVisible() {
        super.navBarWindowIsAlwaysVisible()
    }

    @FlakyTest
    @Test
    override fun navBarLayerIsAlwaysVisible() {
        super.navBarLayerIsAlwaysVisible()
    }

    @FlakyTest
    @Test
    override fun navBarLayerRotatesAndScales() {
        super.navBarLayerRotatesAndScales()
    }

    companion object {
        private val testFactory = FlickerTestParameterFactory.getInstance()