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

Commit d999102f authored by Charles Chen's avatar Charles Chen Committed by Android (Google) Code Review
Browse files

Merge changes from topic "multiple_bubbles" into main

* changes:
  Verify multiple bubble launch
  Test entering bubble via drag to bubble bar
parents 512b3de3 af0e0914
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -84,6 +84,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.flicker.bubbles.EnterBubbleViaBubbleMenuTest"],
}

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

test_module_config {
    name: "WMShellExplicitFlickerTestsBubbles-EnterBubbleWithImeViaBubbleMenuTest",
    base: "WMShellExplicitFlickerTestsBubbles",
+3 −0
Original line number Diff line number Diff line
@@ -12,6 +12,9 @@
    {
      "name": "WMShellExplicitFlickerTestsBubbles-EnterBubbleViaBubbleMenuTest"
    },
    {
      "name": "WMShellExplicitFlickerTestsBubbles-EnterBubbleViaDragToBubbleBarTest"
    },
    {
      "name": "WMShellExplicitFlickerTestsBubbles-EnterBubbleWithImeViaBubbleMenuTest"
    },
+2 −1
Original line number Diff line number Diff line
@@ -73,7 +73,8 @@ class DismissExpandedBubbleViaBubbleViewTest(navBar: NavBar) :
                setUpBeforeTransition(instrumentation, wmHelper)
                launchBubbleViaBubbleMenu(testApp, tapl, wmHelper)
            },
            transition = { dismissBubbleAppViaBubbleView(uiDevice, wmHelper) }
            transition = { dismissBubbleAppViaBubbleView(uiDevice, wmHelper) },
            tearDownAfterTransition = { testApp.exit() }
        )
    }

+4 −54
Original line number Diff line number Diff line
@@ -19,11 +19,10 @@ package com.android.wm.shell.flicker.bubbles
import android.platform.test.annotations.Presubmit
import android.platform.test.annotations.RequiresFlagsEnabled
import android.tools.NavBar
import android.tools.traces.component.ComponentNameMatcher.Companion.BUBBLE
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.BubbleAppBecomesExpandedTestCases
import com.android.wm.shell.flicker.bubbles.testcase.EnterBubbleTestCases
import com.android.wm.shell.flicker.bubbles.utils.ApplyPerParameterRule
import com.android.wm.shell.flicker.bubbles.utils.FlickerPropertyInitializer
import com.android.wm.shell.flicker.bubbles.utils.RecordTraceWithTransitionRule
@@ -31,7 +30,6 @@ import com.android.wm.shell.flicker.bubbles.utils.launchBubbleViaBubbleMenu
import com.android.wm.shell.flicker.bubbles.utils.setUpBeforeTransition
import org.junit.FixMethodOrder
import org.junit.Rule
import org.junit.Test
import org.junit.runners.MethodSorters

/**
@@ -46,15 +44,14 @@ import org.junit.runners.MethodSorters
 * ```
 * Verified tests:
 * - [BubbleFlickerTestBase]
 * - [BubbleAppBecomesExpandedTestCases]
 * - Bubble becomes visible
 * - [EnterBubbleTestCases]
 */
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE)
@RequiresDevice
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Presubmit
open class EnterBubbleViaBubbleMenuTest(navBar: NavBar) :
    BubbleFlickerTestBase(), BubbleAppBecomesExpandedTestCases {
open class EnterBubbleViaBubbleMenuTest(navBar: NavBar) : BubbleFlickerTestBase(),
    EnterBubbleTestCases {

    companion object : FlickerPropertyInitializer() {
        private val recordTraceWithTransitionRule = RecordTraceWithTransitionRule(
@@ -72,51 +69,4 @@ open class EnterBubbleViaBubbleMenuTest(navBar: NavBar) :

    override val traceDataReader
        get() = recordTraceWithTransitionRule.reader

// region Bubble related tests

    /**
     * Verifies the bubble window is visible at the end of transition.
     */
    @Test
    fun bubbleWindowIsVisibleAtEnd() {
        wmStateSubjectAtEnd.isNonAppWindowVisible(BUBBLE)
    }

    /**
     * Verifies the bubble layer is visible at the end of transition.
     */
    @Test
    fun bubbleLayerIsVisibleAtEnd() {
        layerTraceEntrySubjectAtEnd.isVisible(BUBBLE)
    }

    /**
     * Verifies the bubble window becomes visible.
     */
    @Test
    fun bubbleWindowBecomesVisible() {
        wmTraceSubject
            // Bubble app window may not have been added to WM hierarchy at the start of the
            // transition.
            .isNonAppWindowInvisible(BUBBLE)
            .then()
            .isAboveAppWindowVisible(BUBBLE)
            .forAllEntries()
    }

    /**
     * Verifies the bubble layer becomes visible.
     */
    @Test
    fun bubbleLayerBecomesVisible() {
        layersTraceSubject
            // Bubble may not appear at the start of the transition.
            .isInvisible(BUBBLE)
            .then()
            .isVisible(BUBBLE)
            .forAllEntries()
    }

// endregion
}
 No newline at end of file
+106 −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.test.annotations.Presubmit
import android.platform.test.annotations.RequiresFlagsEnabled
import android.tools.NavBar
import android.tools.traces.component.ComponentNameMatcher.Companion.TASK_BAR
import androidx.test.filters.FlakyTest
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.EnterBubbleTestCases
import com.android.wm.shell.flicker.bubbles.utils.ApplyPerParameterRule
import com.android.wm.shell.flicker.bubbles.utils.FlickerPropertyInitializer
import com.android.wm.shell.flicker.bubbles.utils.RecordTraceWithTransitionRule
import com.android.wm.shell.flicker.bubbles.utils.launchBubbleViaDragToBubbleBar
import com.android.wm.shell.flicker.bubbles.utils.setUpBeforeTransition
import com.android.wm.shell.flicker.utils.SplitScreenUtils
import org.junit.Assume.assumeTrue
import org.junit.Before
import org.junit.FixMethodOrder
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TestRule
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized

/**
 * Test entering bubble via dragging the [testApp] icon from task bar to bubble bar location.
 *
 * To run this test: `atest WMShellExplicitFlickerTestsBubbles:EnterBubbleViaDragToBubbleBarTest`
 *
 * Pre-steps:
 * ```
 *     Drag [testApp] icon to hotseat
 * ```
 * Actions:
 * ```
 *     Switch to overview to show task bar.
 *     Drag the [testApp] icon from task bar to bubble bar location.
 * ```
 * Verified tests:
 * - [BubbleFlickerTestBase]
 * - [EnterBubbleTestCases]
 */
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE, Flags.FLAG_ENABLE_BUBBLE_BAR)
@RequiresDevice
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Presubmit
class EnterBubbleViaDragToBubbleBarTest(navBar: NavBar) : BubbleFlickerTestBase(),
    EnterBubbleTestCases {

    companion object : FlickerPropertyInitializer() {
        private val recordTraceWithTransitionRule = RecordTraceWithTransitionRule(
            setUpBeforeTransition = {
                setUpBeforeTransition(instrumentation, wmHelper)
                SplitScreenUtils.createShortcutOnHotseatIfNotExist(tapl, testApp.appName)
            },
            transition = { launchBubbleViaDragToBubbleBar(testApp, tapl, wmHelper) },
            tearDownAfterTransition = { testApp.exit(wmHelper) }
        )

        // TODO(b/428566420): LauncherInstrumentation doesn't support to drag to bubble bar on 3
        //  button nav mode.
        @Parameterized.Parameters(name = "{0}")
        @JvmStatic
        fun data(): List<NavBar> = listOf(NavBar.MODE_GESTURAL)
    }

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

    override val traceDataReader
        get() = recordTraceWithTransitionRule.reader

    @Before
    override fun setUp() {
        // Bubble and task bar are not available on phone.
        assumeTrue(tapl.isTablet)
        super.setUp()
    }

    @FlakyTest(bugId = 428630722)
    @Test
    override fun focusChanges() {
        eventLogSubject.focusChanges(TASK_BAR.toWindowName(), testApp.toWindowName())
    }
}
 No newline at end of file
Loading