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

Commit 9f90b528 authored by Charles Chen's avatar Charles Chen
Browse files

Verifies bubble bar show/hide with task bar

Test: atest BubbleBarVisibilityTest
Bug: 396020056
Flag: TEST_ONLY
Change-Id: I2f058cf82087049f8275403aca323e9ee35da062
parent 0036f991
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -48,20 +48,13 @@ android_test {
}

// Auto generated section, don't update it manually

test_module_config {
    name: "WMShellExplicitFlickerTestsBubbles-BubbleBarMovesTest",
    base: "WMShellExplicitFlickerTestsBubbles",
    test_suites: ["device-tests"],
    include_filters: ["com.android.wm.shell.flicker.bubbles.BubbleBarMovesTest"],
}

test_module_config {
    name: "WMShellExplicitFlickerTestsBubbles-CatchAll",
    base: "WMShellExplicitFlickerTestsBubbles",
    test_suites: ["device-tests"],
    exclude_filters: [
        "com.android.wm.shell.flicker.bubbles.BubbleBarMovesTest",
        "com.android.wm.shell.flicker.bubbles.BubbleBarVisibilityTest",
        "com.android.wm.shell.flicker.bubbles.CollapseBubbleAppViaBackTest",
        "com.android.wm.shell.flicker.bubbles.CollapseBubbleAppViaTouchOutsideTest",
        "com.android.wm.shell.flicker.bubbles.DismissExpandedBubbleViaBubbleBarHandleTest",
@@ -78,6 +71,20 @@ test_module_config {
    ],
}

test_module_config {
    name: "WMShellExplicitFlickerTestsBubbles-BubbleBarMovesTest",
    base: "WMShellExplicitFlickerTestsBubbles",
    test_suites: ["device-tests"],
    include_filters: ["com.android.wm.shell.flicker.bubbles.BubbleBarMovesTest"],
}

test_module_config {
    name: "WMShellExplicitFlickerTestsBubbles-BubbleBarVisibilityTest",
    base: "WMShellExplicitFlickerTestsBubbles",
    test_suites: ["device-tests"],
    include_filters: ["com.android.wm.shell.flicker.bubbles.BubbleBarVisibilityTest"],
}

test_module_config {
    name: "WMShellExplicitFlickerTestsBubbles-CollapseBubbleAppViaBackTest",
    base: "WMShellExplicitFlickerTestsBubbles",
+3 −0
Original line number Diff line number Diff line
@@ -3,6 +3,9 @@
    {
      "name": "WMShellExplicitFlickerTestsBubbles-BubbleBarMovesTest"
    },
    {
      "name": "WMShellExplicitFlickerTestsBubbles-BubbleBarVisibilityTest"
    },
    {
      "name": "WMShellExplicitFlickerTestsBubbles-CatchAll"
    },
+131 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.bubbles

import android.platform.systemui_tapl.ui.Root
import android.platform.test.annotations.Presubmit
import android.platform.test.annotations.RequiresFlagsEnabled
import android.tools.NavBar
import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.helpers.NonResizeableAppHelper
import com.android.wm.shell.Flags
import com.android.wm.shell.Utils
import com.android.wm.shell.flicker.bubbles.testcase.BubbleAlwaysVisibleTestCases
import com.android.wm.shell.flicker.bubbles.utils.ApplyPerParameterRule
import com.android.wm.shell.flicker.bubbles.utils.BubbleFlickerTestHelper.collapseBubbleAppViaTouchOutside
import com.android.wm.shell.flicker.bubbles.utils.BubbleFlickerTestHelper.launchBubbleViaBubbleMenu
import com.android.wm.shell.flicker.bubbles.utils.FlickerPropertyInitializer
import com.android.wm.shell.flicker.bubbles.utils.RecordTraceWithTransitionRule
import org.junit.Assume.assumeTrue
import org.junit.Before
import org.junit.FixMethodOrder
import org.junit.Rule
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized

/**
 * Test that when the taskbar is shown, the bubble bar is also shown.
 *
 * To run this test: `atest WMShellExplicitFlickerTestsBubbles:BubbleBarVisibilityTest`
 *
 * Pre-steps:
 * ```
 *     1. Launch a bubble and collapse it to show the bubble bar.
 *     2. Launch a fullscreen app to show the task bar and bubble bar.
 *     3. Wait for both task and bubble bar stashed.
 * ```
 *
 * Actions:
 * ```
 *     Swipe up to show the task bar.
 *     Checks the bubble bar is shown.
 *     Wait for task bar stashed.
 *     Checks the bubble bar is stashed.
 * ```
 *
 * Verified tests:
 * - [BubbleFlickerTestBase]
 * - [BubbleAlwaysVisibleTestCases]
 */
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE, Flags.FLAG_ENABLE_BUBBLE_BAR)
@RequiresDevice
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Presubmit
@RunWith(Parameterized::class)
class BubbleBarVisibilityTest(navBar: NavBar) : BubbleFlickerTestBase(),
    BubbleAlwaysVisibleTestCases {

    companion object : FlickerPropertyInitializer() {
        private val fullscreenApp = NonResizeableAppHelper(instrumentation)
        private val recordTraceWithTransitionRule = RecordTraceWithTransitionRule(
            setUpBeforeTransition = {
                launchBubbleViaBubbleMenu(testApp, tapl, wmHelper)
                collapseBubbleAppViaTouchOutside(testApp, wmHelper)
                fullscreenApp.launchViaIntent()

                // Checks fullscreen app and bubble window are shown.
                wmHelper.StateSyncBuilder()
                    .withAppTransitionIdle()
                    .withTopVisibleApps(fullscreenApp)
                    .withBubbleShown()
                    .waitForAndVerify()

                tapl.launchedAppState.assertTaskbarHidden()
                // TODO(b/436755889): Checks why stashed Bubble bar is not visible for UI automator.
                Root.get().verifyBubbleBarIsHidden()
            },
            transition = {
                tapl.showTaskbarIfHidden()
                // Checks the bubble bar is visible
                Root.get().bubbleBar

                // Wait until task bar hidden with timeout.
                tapl.launchedAppState.assertTaskbarHidden()
                // TODO(b/436755889): Checks why stashed Bubble bar is not visible for UI automator.
                Root.get().verifyBubbleBarIsHidden()
            },
            tearDownAfterTransition = {
                testApp.exit()
                fullscreenApp.exit()
            }
        )

        // Don't verify 3-button because the task bar is persistent.
        @Parameterized.Parameters(name = "{0}")
        @JvmStatic
        fun data(): List<NavBar> = listOf(NavBar.MODE_GESTURAL)
    }

    @get:Rule
    val setUpRule = ApplyPerParameterRule(
        Utils.testSetupRule(navBar).around(recordTraceWithTransitionRule),
        params = arrayOf(navBar)
    )

    override val traceDataReader
        get() = recordTraceWithTransitionRule.reader

    @Before
    override fun setUp() {
        // Bubble and task bar are only enabled on large screen devices.
        assumeTrue(tapl.isTablet)
        // Only transient task bar can show/hide.
        assumeTrue(tapl.isTransientTaskbar)
        super.setUp()
    }
}
+1 −27
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.wm.shell.flicker.bubbles

import android.platform.test.flag.junit.CheckFlagsRule
import android.platform.test.flag.junit.DeviceFlagsValueProvider
import android.tools.NavBar
import android.tools.Tag
import android.tools.device.apphelpers.StandardAppHelper
import android.tools.flicker.assertions.SubjectsParser
@@ -41,15 +40,11 @@ import com.android.wm.shell.flicker.bubbles.utils.FlickerPropertyInitializer
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

/**
 * The base class of Bubble flicker tests, which includes:
 * - Generic tests: checks there's no flicker in visible windows/layers
 * - Launcher visibility tests: checks launcher window/layer is always visible
 * - System Bars tests: checks the visibility of navigation and status bar
 * - Verify all tests with both gestural and 3-button navigation mode
 * - System Bars tests; checks the visibility of navigation and status bar
 */
abstract class BubbleFlickerTestBase : BubbleFlickerSubjects {

@@ -180,27 +175,6 @@ abstract class BubbleFlickerTestBase : BubbleFlickerSubjects {
    }

// endregion

// region Launcher visibility tests

    /**
     * Verifies the launcher window is always visible.
     */
    @Test
    fun launcherWindowIsAlwaysVisible() {
        wmTraceSubject.isAppWindowVisible(ComponentNameMatcher.LAUNCHER).forAllEntries()
    }

    /**
     * Verifies the launcher layer is always visible.
     */
    @Test
    fun launcherLayerIsAlwaysVisible() {
        layersTraceSubject.isVisible(ComponentNameMatcher.LAUNCHER).forAllEntries()
    }

// endregion

// region System bars tests

    /**
+3 −5
Original line number Diff line number Diff line
@@ -25,8 +25,7 @@ import android.tools.traces.component.ComponentNameMatcher.Companion.LAUNCHER
import androidx.test.filters.RequiresDevice
import com.android.wm.shell.Flags
import com.android.wm.shell.Utils
import com.android.wm.shell.flicker.bubbles.testcase.BubbleAlwaysVisibleTestCases
import com.android.wm.shell.flicker.bubbles.testcase.BubbleAppBecomesExpandedTestCases
import com.android.wm.shell.flicker.bubbles.testcase.MultipleBubbleExpandBubbleAppTestCases
import com.android.wm.shell.flicker.bubbles.utils.ApplyPerParameterRule
import com.android.wm.shell.flicker.bubbles.utils.BubbleFlickerTestHelper.dismissBubbleAppViaBubbleView
import com.android.wm.shell.flicker.bubbles.utils.BubbleFlickerTestHelper.launchBubbleViaBubbleMenu
@@ -58,8 +57,7 @@ import org.junit.runners.Parameterized
 *
 * Verified tests:
 * - [BubbleFlickerTestBase]
 * - [BubbleAlwaysVisibleTestCases]
 * - [BubbleAppBecomesExpandedTestCases]
 * - [MultipleBubbleExpandBubbleAppTestCases]
 */
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE)
@RequiresDevice
@@ -67,7 +65,7 @@ import org.junit.runners.Parameterized
@Presubmit
@RunWith(Parameterized::class)
class EnterBubbleViaOverflowMenuTest(navBar: NavBar) : BubbleFlickerTestBase(),
    BubbleAlwaysVisibleTestCases, BubbleAppBecomesExpandedTestCases {
    MultipleBubbleExpandBubbleAppTestCases {

    companion object : FlickerPropertyInitializer() {
        private val messageApp = MessagingAppHelper()
Loading