From d752b2e3b7168a2d3acd9da8e7a436f5d79abf00 Mon Sep 17 00:00:00 2001 From: Charles Chen Date: Fri, 20 Dec 2024 20:34:48 +0800 Subject: Test entering PIP from split-screen with bottom half layout Bug: 356277166 Test: atest BottomHalfEnterPipToOtherOrientation Test: atest BottomHalfSetRequestedOrientationWhilePinned Flag: com.android.window.flags.better_support_non_match_parent_activity Change-Id: If6564c17084c1f3cc339e093a3a071532df8667b --- .../wm/flicker/helpers/BottomHalfPipAppHelper.kt | 27 ++-- .../res/layout/activity_bottom_half_pip.xml | 154 +++++++++++++++++++++ .../wm/flicker/testapp/BottomHalfPipActivity.java | 49 ++++++- .../server/wm/flicker/testapp/PipActivity.java | 2 +- 4 files changed, 217 insertions(+), 15 deletions(-) create mode 100644 tests/FlickerTests/test-apps/flickerapp/res/layout/activity_bottom_half_pip.xml (limited to 'tests') diff --git a/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/BottomHalfPipAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/BottomHalfPipAppHelper.kt index ed2cff4a9515..fe344c9b79f2 100644 --- a/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/BottomHalfPipAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/BottomHalfPipAppHelper.kt @@ -18,25 +18,28 @@ package com.android.server.wm.flicker.helpers import android.app.Instrumentation import android.content.Intent -import android.tools.traces.parsers.toFlickerComponent import android.tools.traces.parsers.WindowManagerStateHelper -import com.android.server.wm.flicker.testapp.ActivityOptions +import android.tools.traces.parsers.toFlickerComponent +import com.android.server.wm.flicker.testapp.ActivityOptions.BottomHalfPip class BottomHalfPipAppHelper( instrumentation: Instrumentation, private val useLaunchingActivity: Boolean = false, + private val fillTaskOnCreate: Boolean = true, ) : PipAppHelper( instrumentation, - appName = ActivityOptions.BottomHalfPip.LABEL, - componentNameMatcher = ActivityOptions.BottomHalfPip.COMPONENT - .toFlickerComponent() + appName = BottomHalfPip.LABEL, + componentNameMatcher = BottomHalfPip.COMPONENT.toFlickerComponent() ) { override val openAppIntent: Intent get() = super.openAppIntent.apply { component = if (useLaunchingActivity) { - ActivityOptions.BottomHalfPip.LAUNCHING_APP_COMPONENT + BottomHalfPip.LAUNCHING_APP_COMPONENT } else { - ActivityOptions.BottomHalfPip.COMPONENT + BottomHalfPip.COMPONENT + } + if (fillTaskOnCreate) { + putExtra(BottomHalfPip.EXTRA_BOTTOM_HALF_LAYOUT, false.toString()) } } @@ -44,9 +47,17 @@ class BottomHalfPipAppHelper( launchViaIntent( wmHelper, Intent().apply { - component = ActivityOptions.BottomHalfPip.COMPONENT + component = BottomHalfPip.COMPONENT addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) } ) } + + fun toggleBottomHalfLayout() { + clickObject(TOGGLE_BOTTOM_HALF_LAYOUT_ID) + } + + companion object { + private const val TOGGLE_BOTTOM_HALF_LAYOUT_ID = "toggle_bottom_half_layout" + } } \ No newline at end of file diff --git a/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_bottom_half_pip.xml b/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_bottom_half_pip.xml new file mode 100644 index 000000000000..2f9c3aa82057 --- /dev/null +++ b/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_bottom_half_pip.xml @@ -0,0 +1,154 @@ + + + + + + +