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

Commit a7193eab authored by Chris Li's avatar Chris Li Committed by Android (Google) Code Review
Browse files

Merge "Scroll down to avoid tapping on nav bar" into main

parents e79eeea7 26e9b104
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ import org.junit.runners.Parameterized
 * Transitions: From A launch a trampoline Activity T, T launches secondary Activity B and finishes
 * itself, end up in split A|B.
 *
 * To run this test: `atest FlickerTestsOther:OpenTrampolineActivityTest`
 * To run this test: `atest FlickerTestsActivityEmbedding:OpenTrampolineActivityTest`
 */
@FlakyTest(bugId = 341209752)
@RequiresDevice
+19 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server.wm.flicker.helpers

import android.app.Instrumentation
import android.os.SystemClock
import android.tools.PlatformConsts
import android.tools.device.apphelpers.StandardAppHelper
import android.tools.helpers.FIND_TIMEOUT
@@ -25,6 +26,7 @@ import android.tools.traces.parsers.WindowManagerStateHelper
import android.tools.traces.parsers.toFlickerComponent
import android.util.Log
import androidx.test.uiautomator.By
import androidx.test.uiautomator.Direction
import androidx.test.uiautomator.Until
import androidx.window.extensions.WindowExtensions
import androidx.window.extensions.WindowExtensionsProvider
@@ -83,6 +85,7 @@ constructor(
     * activity and finish itself.
     */
    fun launchTrampolineActivity(wmHelper: WindowManagerStateHelper) {
        scrollToBottom()
        val launchButton =
            uiDevice.wait(
                Until.findObject(By.res(packageName, "launch_trampoline_button")),
@@ -210,6 +213,7 @@ constructor(
     * placeholder secondary activity based on the placeholder rule.
     */
    fun launchPlaceholderSplitRTL(wmHelper: WindowManagerStateHelper) {
        scrollToBottom()
        val launchButton =
            uiDevice.wait(
                Until.findObject(By.res(packageName, "launch_placeholder_split_rtl_button")),
@@ -224,6 +228,21 @@ constructor(
            .waitForAndVerify()
    }

    /**
     * Scrolls to the bottom of the launch options. This is needed if the launch button is at the
     * bottom. Otherwise the click may trigger touch on navBar.
     */
    private fun scrollToBottom() {
        val launchOptionsList = uiDevice.wait(
            Until.findObject(By.res(packageName, "launch_options_list")),
            FIND_TIMEOUT
        )
        requireNotNull(launchOptionsList) { "Unable to find the list of launch options" }
        launchOptionsList.scrollUntil(Direction.DOWN, Until.scrollFinished(Direction.DOWN))
        // Wait a bit after scrolling, otherwise the immediate click may not be treated as "click".
        SystemClock.sleep(1000L)
    }

    companion object {
        private const val TAG = "ActivityEmbeddingAppHelper"

+2 −0
Original line number Diff line number Diff line
@@ -21,8 +21,10 @@
    android:background="@android:color/holo_orange_light">

    <LinearLayout
        android:id="@+id/launch_options_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="48dp"
        android:orientation="vertical">

        <Button