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

Commit 4465f3e0 authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Verify launching a split-screen task to bubble" into main

parents 3cadf209 bf3777ec
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ test_module_config {
        "com.android.wm.shell.flicker.bubbles.ScrollableBubbleAppTest",
        "com.android.wm.shell.flicker.bubbles.SwitchBetweenBubblesTest",
        "com.android.wm.shell.flicker.bubbles.ExpandedBubbleAppMoveTest",
        "com.android.wm.shell.flicker.bubbles.RelaunchSplitScreenToBubbleTest",
    ],
}

@@ -201,3 +202,10 @@ test_module_config {
    test_suites: ["device-tests"],
    include_filters: ["com.android.wm.shell.flicker.bubbles.SwitchBetweenBubblesTest"],
}

test_module_config {
    name: "WMShellExplicitFlickerTestsBubbles-RelaunchSplitScreenToBubbleTest",
    base: "WMShellExplicitFlickerTestsBubbles",
    test_suites: ["device-tests"],
    include_filters: ["com.android.wm.shell.flicker.bubbles.RelaunchSplitScreenToBubbleTest"],
}
+3 −0
Original line number Diff line number Diff line
@@ -62,6 +62,9 @@
    },
    {
      "name": "WMShellExplicitFlickerTestsBubbles-SwitchBetweenBubblesTest"
    },
    {
      "name": "WMShellExplicitFlickerTestsBubbles-RelaunchSplitScreenToBubbleTest"
    }
  ]
}
+111 −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.Rotation
import android.tools.device.apphelpers.StandardAppHelper
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.helpers.ShowWhenLockedAppHelper
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.BubbleFlickerTestHelper.launchBubbleViaBubbleMenu
import com.android.wm.shell.flicker.bubbles.utils.FlickerPropertyInitializer
import com.android.wm.shell.flicker.bubbles.utils.RecordTraceWithTransitionRule
import com.android.wm.shell.flicker.utils.SplitScreenUtils.enterSplit
import org.junit.FixMethodOrder
import org.junit.Rule
import org.junit.Test
import org.junit.runners.MethodSorters

/**
 * Test entering bubble via clicking bubble menu while the app task was in split-screen.
 *
 * To run this test:
 *     `atest WMShellExplicitFlickerTestsBubbles:RelaunchSplitScreenToBubbleTest`
 *
 * Pre-steps:
 * ```
 *     Put two apps to split-screen and move the splits to background.
 * ```
 * Actions:
 * ```
 *     Click the bubble menu to launch [testApp] into bubble.
 * ```
 * Verified tests:
 * - [BubbleFlickerTestBase]
 * - [EnterBubbleTestCases]
 */
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE)
@RequiresDevice
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Presubmit
class RelaunchSplitScreenToBubbleTest : BubbleFlickerTestBase(),
    EnterBubbleTestCases {

    companion object : FlickerPropertyInitializer() {
        val testApp2: StandardAppHelper = ShowWhenLockedAppHelper(instrumentation)

        private val recordTraceWithTransitionRule = RecordTraceWithTransitionRule(
            setUpBeforeTransition = {
                enterSplit(
                    wmHelper,
                    tapl,
                    uiDevice,
                    primaryApp = testApp,
                    secondaryApp = testApp2,
                    Rotation.ROTATION_0
                )
                tapl.goHome()
            },
            transition = {
                launchBubbleViaBubbleMenu(
                    testApp,
                    tapl,
                    wmHelper
                )
            },
            tearDownAfterTransition = {
                testApp.exit(wmHelper)
                testApp2.exit(wmHelper)
            }
        )
    }

    @get:Rule
    val setUpRule = ApplyPerParameterRule(
        Utils.testSetupRule(NavBar.MODE_GESTURAL).around(recordTraceWithTransitionRule)
    )

    override val traceDataReader
        get() = recordTraceWithTransitionRule.reader

    @Test
    @FlakyTest(bugId = 437224803)
    override fun launcherWindowIsAlwaysVisible() {
    }

    @Test
    @FlakyTest(bugId = 437224803)
    override fun launcherLayerIsAlwaysVisible() {
    }
}