Loading tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -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 Loading tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt +19 −0 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading Loading @@ -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")), Loading Loading @@ -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")), Loading @@ -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" Loading tests/FlickerTests/test-apps/flickerapp/res/layout/activity_embedding_main_layout.xml +2 −0 Original line number Diff line number Diff line Loading @@ -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 Loading Loading
tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -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 Loading
tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt +19 −0 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading Loading @@ -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")), Loading Loading @@ -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")), Loading @@ -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" Loading
tests/FlickerTests/test-apps/flickerapp/res/layout/activity_embedding_main_layout.xml +2 −0 Original line number Diff line number Diff line Loading @@ -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 Loading