[DO NOT MERGE] Dump windowing mode in Winscope traces am: 732fa80c97

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15879490

Change-Id: I4513921002f34b1e24567e57d57b462ce83bf793
This commit is contained in:
Pablo Gamito
2021-10-08 09:04:15 +00:00
committed by Automerger Merge Worker
81 changed files with 1108 additions and 369 deletions

View File

@@ -23,6 +23,7 @@ import static android.graphics.Matrix.MSKEW_Y;
import static android.graphics.Matrix.MTRANS_X; import static android.graphics.Matrix.MTRANS_X;
import static android.graphics.Matrix.MTRANS_Y; import static android.graphics.Matrix.MTRANS_Y;
import static android.view.SurfaceControlProto.HASH_CODE; import static android.view.SurfaceControlProto.HASH_CODE;
import static android.view.SurfaceControlProto.LAYER_ID;
import static android.view.SurfaceControlProto.NAME; import static android.view.SurfaceControlProto.NAME;
import android.annotation.FloatRange; import android.annotation.FloatRange;
@@ -242,6 +243,7 @@ public final class SurfaceControl implements Parcelable {
private static native int nativeGetGPUContextPriority(); private static native int nativeGetGPUContextPriority();
private static native void nativeSetTransformHint(long nativeObject, int transformHint); private static native void nativeSetTransformHint(long nativeObject, int transformHint);
private static native int nativeGetTransformHint(long nativeObject); private static native int nativeGetTransformHint(long nativeObject);
private static native int nativeGetLayerId(long nativeObject);
@Nullable @Nullable
@GuardedBy("mLock") @GuardedBy("mLock")
@@ -357,8 +359,6 @@ public final class SurfaceControl implements Parcelable {
@GuardedBy("mLock") @GuardedBy("mLock")
private int mHeight; private int mHeight;
private int mTransformHint;
private WeakReference<View> mLocalOwnerView; private WeakReference<View> mLocalOwnerView;
static GlobalTransactionWrapper sGlobalTransaction; static GlobalTransactionWrapper sGlobalTransaction;
@@ -1541,6 +1541,7 @@ public final class SurfaceControl implements Parcelable {
final long token = proto.start(fieldId); final long token = proto.start(fieldId);
proto.write(HASH_CODE, System.identityHashCode(this)); proto.write(HASH_CODE, System.identityHashCode(this));
proto.write(NAME, mName); proto.write(NAME, mName);
proto.write(LAYER_ID, getLayerId());
proto.end(token); proto.end(token);
} }
@@ -3675,4 +3676,15 @@ public final class SurfaceControl implements Parcelable {
public void setTransformHint(@Surface.Rotation int transformHint) { public void setTransformHint(@Surface.Rotation int transformHint) {
nativeSetTransformHint(mNativeObject, transformHint); nativeSetTransformHint(mNativeObject, transformHint);
} }
/**
* @hide
*/
public int getLayerId() {
if (mNativeObject != 0) {
return nativeGetLayerId(mNativeObject);
}
return -1;
}
} }

View File

@@ -1827,6 +1827,12 @@ static jint nativeGetTransformHint(JNIEnv* env, jclass clazz, jlong nativeSurfac
return toRotationInt(ui::Transform::toRotation((transformHintRotationFlags))); return toRotationInt(ui::Transform::toRotation((transformHintRotationFlags)));
} }
static jint nativeGetLayerId(JNIEnv* env, jclass clazz, jlong nativeSurfaceControl) {
sp<SurfaceControl> surface(reinterpret_cast<SurfaceControl*>(nativeSurfaceControl));
return surface->getLayerId();
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
static const JNINativeMethod sSurfaceControlMethods[] = { static const JNINativeMethod sSurfaceControlMethods[] = {
@@ -2026,6 +2032,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
(void*)nativeSetTrustedOverlay }, (void*)nativeSetTrustedOverlay },
{"nativeSetDropInputMode", "(JJI)V", {"nativeSetDropInputMode", "(JJI)V",
(void*)nativeSetDropInputMode }, (void*)nativeSetDropInputMode },
{"nativeGetLayerId", "(J)I",
(void*)nativeGetLayerId },
// clang-format on // clang-format on
}; };

View File

@@ -480,6 +480,7 @@ message WindowContainerProto {
optional SurfaceAnimatorProto surface_animator = 4; optional SurfaceAnimatorProto surface_animator = 4;
repeated WindowContainerChildProto children = 5; repeated WindowContainerChildProto children = 5;
optional IdentifierProto identifier = 6; optional IdentifierProto identifier = 6;
optional .android.view.SurfaceControlProto surface_control = 7;
} }
/* represents a generic child of a WindowContainer */ /* represents a generic child of a WindowContainer */

View File

@@ -29,4 +29,5 @@ message SurfaceControlProto {
optional int32 hash_code = 1; optional int32 hash_code = 1;
optional string name = 2 [ (android.privacy).dest = DEST_EXPLICIT ]; optional string name = 2 [ (android.privacy).dest = DEST_EXPLICIT ];
optional int32 layerId = 3;
} }

View File

@@ -14,13 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
@file:JvmName("CommonAssertions")
package com.android.wm.shell.flicker package com.android.wm.shell.flicker
import android.content.ComponentName
import android.graphics.Region import android.graphics.Region
import android.view.Surface import android.view.Surface
import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.helpers.WindowUtils import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.traces.common.FlickerComponentName
fun FlickerTestParameter.appPairsDividerIsVisibleAtEnd() { fun FlickerTestParameter.appPairsDividerIsVisibleAtEnd() {
assertLayersEnd { assertLayersEnd {
@@ -72,7 +73,7 @@ fun FlickerTestParameter.dockedStackDividerNotExistsAtEnd() {
fun FlickerTestParameter.appPairsPrimaryBoundsIsVisibleAtEnd( fun FlickerTestParameter.appPairsPrimaryBoundsIsVisibleAtEnd(
rotation: Int, rotation: Int,
primaryComponent: ComponentName primaryComponent: FlickerComponentName
) { ) {
assertLayersEnd { assertLayersEnd {
val dividerRegion = layer(APP_PAIR_SPLIT_DIVIDER_COMPONENT).visibleRegion.region val dividerRegion = layer(APP_PAIR_SPLIT_DIVIDER_COMPONENT).visibleRegion.region
@@ -83,7 +84,7 @@ fun FlickerTestParameter.appPairsPrimaryBoundsIsVisibleAtEnd(
fun FlickerTestParameter.dockedStackPrimaryBoundsIsVisibleAtEnd( fun FlickerTestParameter.dockedStackPrimaryBoundsIsVisibleAtEnd(
rotation: Int, rotation: Int,
primaryComponent: ComponentName primaryComponent: FlickerComponentName
) { ) {
assertLayersEnd { assertLayersEnd {
val dividerRegion = layer(DOCKED_STACK_DIVIDER_COMPONENT).visibleRegion.region val dividerRegion = layer(DOCKED_STACK_DIVIDER_COMPONENT).visibleRegion.region
@@ -94,7 +95,7 @@ fun FlickerTestParameter.dockedStackPrimaryBoundsIsVisibleAtEnd(
fun FlickerTestParameter.appPairsSecondaryBoundsIsVisibleAtEnd( fun FlickerTestParameter.appPairsSecondaryBoundsIsVisibleAtEnd(
rotation: Int, rotation: Int,
secondaryComponent: ComponentName secondaryComponent: FlickerComponentName
) { ) {
assertLayersEnd { assertLayersEnd {
val dividerRegion = layer(APP_PAIR_SPLIT_DIVIDER_COMPONENT).visibleRegion.region val dividerRegion = layer(APP_PAIR_SPLIT_DIVIDER_COMPONENT).visibleRegion.region
@@ -105,7 +106,7 @@ fun FlickerTestParameter.appPairsSecondaryBoundsIsVisibleAtEnd(
fun FlickerTestParameter.dockedStackSecondaryBoundsIsVisibleAtEnd( fun FlickerTestParameter.dockedStackSecondaryBoundsIsVisibleAtEnd(
rotation: Int, rotation: Int,
secondaryComponent: ComponentName secondaryComponent: FlickerComponentName
) { ) {
assertLayersEnd { assertLayersEnd {
val dividerRegion = layer(DOCKED_STACK_DIVIDER_COMPONENT).visibleRegion.region val dividerRegion = layer(DOCKED_STACK_DIVIDER_COMPONENT).visibleRegion.region

View File

@@ -17,8 +17,8 @@
@file:JvmName("CommonConstants") @file:JvmName("CommonConstants")
package com.android.wm.shell.flicker package com.android.wm.shell.flicker
import android.content.ComponentName import com.android.server.wm.traces.common.FlickerComponentName
const val SYSTEM_UI_PACKAGE_NAME = "com.android.systemui" const val SYSTEM_UI_PACKAGE_NAME = "com.android.systemui"
val APP_PAIR_SPLIT_DIVIDER_COMPONENT = ComponentName("", "AppPairSplitDivider#") val APP_PAIR_SPLIT_DIVIDER_COMPONENT = FlickerComponentName("", "AppPairSplitDivider#")
val DOCKED_STACK_DIVIDER_COMPONENT = ComponentName("", "DockedStackDivider#") val DOCKED_STACK_DIVIDER_COMPONENT = FlickerComponentName("", "DockedStackDivider#")

View File

@@ -14,6 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
@file:JvmName("WaitUtils")
package com.android.wm.shell.flicker package com.android.wm.shell.flicker
import android.os.SystemClock import android.os.SystemClock

View File

@@ -100,8 +100,8 @@ class AppPairsTestCannotPairNonResizeableApps(
"Non resizeable app not initialized" "Non resizeable app not initialized"
} }
testSpec.assertWmEnd { testSpec.assertWmEnd {
isVisible(nonResizeableApp.component) isAppWindowVisible(nonResizeableApp.component)
isInvisible(primaryApp.component) isAppWindowInvisible(primaryApp.component)
} }
} }

View File

@@ -77,8 +77,8 @@ class AppPairsTestPairPrimaryAndSecondaryApps(
@Test @Test
fun bothAppWindowsVisible() { fun bothAppWindowsVisible() {
testSpec.assertWmEnd { testSpec.assertWmEnd {
isVisible(primaryApp.component) isAppWindowVisible(primaryApp.component)
isVisible(secondaryApp.component) isAppWindowVisible(secondaryApp.component)
} }
} }

View File

@@ -100,8 +100,8 @@ class AppPairsTestSupportPairNonResizeableApps(
"Non resizeable app not initialized" "Non resizeable app not initialized"
} }
testSpec.assertWmEnd { testSpec.assertWmEnd {
isVisible(nonResizeableApp.component) isAppWindowVisible(nonResizeableApp.component)
isVisible(primaryApp.component) isAppWindowVisible(primaryApp.component)
} }
} }

View File

@@ -81,8 +81,8 @@ class AppPairsTestUnpairPrimaryAndSecondaryApps(
@Test @Test
fun bothAppWindowsInvisible() { fun bothAppWindowsInvisible() {
testSpec.assertWmEnd { testSpec.assertWmEnd {
isInvisible(primaryApp.component) isAppWindowInvisible(primaryApp.component)
isInvisible(secondaryApp.component) isAppWindowInvisible(secondaryApp.component)
} }
} }

View File

@@ -38,6 +38,7 @@ import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.wm.shell.flicker.helpers.AppPairsHelper import com.android.wm.shell.flicker.helpers.AppPairsHelper
import com.android.wm.shell.flicker.helpers.BaseAppHelper import com.android.wm.shell.flicker.helpers.BaseAppHelper
import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.getDevEnableNonResizableMultiWindow import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.getDevEnableNonResizableMultiWindow
@@ -55,7 +56,7 @@ abstract class AppPairsTransition(protected val testSpec: FlickerTestParameter)
protected val activityHelper = ActivityHelper.getInstance() protected val activityHelper = ActivityHelper.getInstance()
protected val appPairsHelper = AppPairsHelper(instrumentation, protected val appPairsHelper = AppPairsHelper(instrumentation,
Components.SplitScreenActivity.LABEL, Components.SplitScreenActivity.LABEL,
Components.SplitScreenActivity.COMPONENT) Components.SplitScreenActivity.COMPONENT.toFlickerComponent())
protected val primaryApp = SplitScreenHelper.getPrimary(instrumentation) protected val primaryApp = SplitScreenHelper.getPrimary(instrumentation)
protected val secondaryApp = SplitScreenHelper.getSecondary(instrumentation) protected val secondaryApp = SplitScreenHelper.getSecondary(instrumentation)

View File

@@ -73,8 +73,8 @@ class RotateTwoLaunchedAppsInAppPairsMode(
@Test @Test
fun bothAppWindowsVisible() { fun bothAppWindowsVisible() {
testSpec.assertWmEnd { testSpec.assertWmEnd {
isVisible(primaryApp.component) isAppWindowVisible(primaryApp.component)
.isVisible(secondaryApp.component) isAppWindowVisible(secondaryApp.component)
} }
} }

View File

@@ -85,8 +85,8 @@ class RotateTwoLaunchedAppsRotateAndEnterAppPairsMode(
@Test @Test
fun bothAppWindowsVisible() { fun bothAppWindowsVisible() {
testSpec.assertWmEnd { testSpec.assertWmEnd {
isVisible(primaryApp.component) isAppWindowVisible(primaryApp.component)
isVisible(secondaryApp.component) isAppWindowVisible(secondaryApp.component)
} }
} }

View File

@@ -17,15 +17,15 @@
package com.android.wm.shell.flicker.helpers package com.android.wm.shell.flicker.helpers
import android.app.Instrumentation import android.app.Instrumentation
import android.content.ComponentName
import android.graphics.Region import android.graphics.Region
import com.android.server.wm.flicker.Flicker import com.android.server.wm.flicker.Flicker
import com.android.server.wm.flicker.helpers.WindowUtils import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.traces.common.FlickerComponentName
class AppPairsHelper( class AppPairsHelper(
instrumentation: Instrumentation, instrumentation: Instrumentation,
activityLabel: String, activityLabel: String,
component: ComponentName component: FlickerComponentName
) : BaseAppHelper(instrumentation, activityLabel, component) { ) : BaseAppHelper(instrumentation, activityLabel, component) {
fun getPrimaryBounds(dividerBounds: Region): android.graphics.Region { fun getPrimaryBounds(dividerBounds: Region): android.graphics.Region {
val primaryAppBounds = Region(0, 0, dividerBounds.bounds.right, val primaryAppBounds = Region(0, 0, dividerBounds.bounds.right,

View File

@@ -17,7 +17,6 @@
package com.android.wm.shell.flicker.helpers package com.android.wm.shell.flicker.helpers
import android.app.Instrumentation import android.app.Instrumentation
import android.content.ComponentName
import android.content.pm.PackageManager.FEATURE_LEANBACK import android.content.pm.PackageManager.FEATURE_LEANBACK
import android.content.pm.PackageManager.FEATURE_LEANBACK_ONLY import android.content.pm.PackageManager.FEATURE_LEANBACK_ONLY
import android.os.SystemProperties import android.os.SystemProperties
@@ -28,13 +27,13 @@ import androidx.test.uiautomator.UiObject2
import androidx.test.uiautomator.Until import androidx.test.uiautomator.Until
import com.android.compatibility.common.util.SystemUtil import com.android.compatibility.common.util.SystemUtil
import com.android.server.wm.flicker.helpers.StandardAppHelper import com.android.server.wm.flicker.helpers.StandardAppHelper
import com.android.server.wm.traces.parser.toWindowName import com.android.server.wm.traces.common.FlickerComponentName
import java.io.IOException import java.io.IOException
abstract class BaseAppHelper( abstract class BaseAppHelper(
instrumentation: Instrumentation, instrumentation: Instrumentation,
launcherName: String, launcherName: String,
component: ComponentName component: FlickerComponentName
) : StandardAppHelper( ) : StandardAppHelper(
instrumentation, instrumentation,
launcherName, launcherName,

View File

@@ -17,10 +17,11 @@
package com.android.wm.shell.flicker.helpers package com.android.wm.shell.flicker.helpers
import android.app.Instrumentation import android.app.Instrumentation
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.wm.shell.flicker.testapp.Components import com.android.wm.shell.flicker.testapp.Components
class FixedAppHelper(instrumentation: Instrumentation) : BaseAppHelper( class FixedAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
instrumentation, instrumentation,
Components.FixedActivity.LABEL, Components.FixedActivity.LABEL,
Components.FixedActivity.COMPONENT Components.FixedActivity.COMPONENT.toFlickerComponent()
) )

View File

@@ -21,13 +21,14 @@ import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.Until import androidx.test.uiautomator.Until
import com.android.server.wm.flicker.helpers.FIND_TIMEOUT import com.android.server.wm.flicker.helpers.FIND_TIMEOUT
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import com.android.wm.shell.flicker.testapp.Components import com.android.wm.shell.flicker.testapp.Components
open class ImeAppHelper(instrumentation: Instrumentation) : BaseAppHelper( open class ImeAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
instrumentation, instrumentation,
Components.ImeActivity.LABEL, Components.ImeActivity.LABEL,
Components.ImeActivity.COMPONENT Components.ImeActivity.COMPONENT.toFlickerComponent()
) { ) {
/** /**
* Opens the IME and wait for it to be displayed * Opens the IME and wait for it to be displayed

View File

@@ -17,14 +17,14 @@
package com.android.wm.shell.flicker.helpers package com.android.wm.shell.flicker.helpers
import android.app.Instrumentation import android.app.Instrumentation
import android.content.ComponentName
import android.content.Context import android.content.Context
import android.provider.Settings import android.provider.Settings
import com.android.server.wm.traces.common.FlickerComponentName
class MultiWindowHelper( class MultiWindowHelper(
instrumentation: Instrumentation, instrumentation: Instrumentation,
activityLabel: String, activityLabel: String,
componentsInfo: ComponentName componentsInfo: FlickerComponentName
) : BaseAppHelper(instrumentation, activityLabel, componentsInfo) { ) : BaseAppHelper(instrumentation, activityLabel, componentsInfo) {
companion object { companion object {

View File

@@ -26,6 +26,7 @@ import androidx.test.uiautomator.BySelector
import androidx.test.uiautomator.Until import androidx.test.uiautomator.Until
import com.android.server.wm.flicker.helpers.FIND_TIMEOUT import com.android.server.wm.flicker.helpers.FIND_TIMEOUT
import com.android.server.wm.flicker.helpers.SYSTEMUI_PACKAGE import com.android.server.wm.flicker.helpers.SYSTEMUI_PACKAGE
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import com.android.wm.shell.flicker.pip.tv.closeTvPipWindow import com.android.wm.shell.flicker.pip.tv.closeTvPipWindow
import com.android.wm.shell.flicker.pip.tv.isFocusedOrHasFocusedChild import com.android.wm.shell.flicker.pip.tv.isFocusedOrHasFocusedChild
@@ -34,7 +35,7 @@ import com.android.wm.shell.flicker.testapp.Components
class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper( class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
instrumentation, instrumentation,
Components.PipActivity.LABEL, Components.PipActivity.LABEL,
Components.PipActivity.COMPONENT Components.PipActivity.COMPONENT.toFlickerComponent()
) { ) {
private val mediaSessionManager: MediaSessionManager private val mediaSessionManager: MediaSessionManager
get() = context.getSystemService(MediaSessionManager::class.java) get() = context.getSystemService(MediaSessionManager::class.java)
@@ -129,7 +130,7 @@ class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
} }
/** /**
* Expands the pip window and dismisses it by clicking on the X button. * Taps the pip window and dismisses it by clicking on the X button.
*/ */
fun closePipWindow(wmHelper: WindowManagerStateHelper) { fun closePipWindow(wmHelper: WindowManagerStateHelper) {
if (isTelevision) { if (isTelevision) {
@@ -137,9 +138,12 @@ class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
} else { } else {
val windowRect = getWindowRect(wmHelper) val windowRect = getWindowRect(wmHelper)
uiDevice.click(windowRect.centerX(), windowRect.centerY()) uiDevice.click(windowRect.centerX(), windowRect.centerY())
val exitPipObject = uiDevice.findObject(By.res(SYSTEMUI_PACKAGE, "dismiss")) // search and interact with the dismiss button
val dismissSelector = By.res(SYSTEMUI_PACKAGE, "dismiss")
uiDevice.wait(Until.hasObject(dismissSelector), FIND_TIMEOUT)
val dismissPipObject = uiDevice.findObject(dismissSelector)
?: error("PIP window dismiss button not found") ?: error("PIP window dismiss button not found")
val dismissButtonBounds = exitPipObject.visibleBounds val dismissButtonBounds = dismissPipObject.visibleBounds
uiDevice.click(dismissButtonBounds.centerX(), dismissButtonBounds.centerY()) uiDevice.click(dismissButtonBounds.centerX(), dismissButtonBounds.centerY())
} }

View File

@@ -17,10 +17,11 @@
package com.android.wm.shell.flicker.helpers package com.android.wm.shell.flicker.helpers
import android.app.Instrumentation import android.app.Instrumentation
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.wm.shell.flicker.testapp.Components import com.android.wm.shell.flicker.testapp.Components
class SimpleAppHelper(instrumentation: Instrumentation) : BaseAppHelper( class SimpleAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
instrumentation, instrumentation,
Components.SimpleActivity.LABEL, Components.SimpleActivity.LABEL,
Components.SimpleActivity.COMPONENT Components.SimpleActivity.COMPONENT.toFlickerComponent()
) )

View File

@@ -17,14 +17,15 @@
package com.android.wm.shell.flicker.helpers package com.android.wm.shell.flicker.helpers
import android.app.Instrumentation import android.app.Instrumentation
import android.content.ComponentName
import android.content.res.Resources import android.content.res.Resources
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.wm.shell.flicker.testapp.Components import com.android.wm.shell.flicker.testapp.Components
class SplitScreenHelper( class SplitScreenHelper(
instrumentation: Instrumentation, instrumentation: Instrumentation,
activityLabel: String, activityLabel: String,
componentsInfo: ComponentName componentsInfo: FlickerComponentName
) : BaseAppHelper(instrumentation, activityLabel, componentsInfo) { ) : BaseAppHelper(instrumentation, activityLabel, componentsInfo) {
companion object { companion object {
@@ -39,16 +40,16 @@ class SplitScreenHelper(
fun getPrimary(instrumentation: Instrumentation): SplitScreenHelper = fun getPrimary(instrumentation: Instrumentation): SplitScreenHelper =
SplitScreenHelper(instrumentation, SplitScreenHelper(instrumentation,
Components.SplitScreenActivity.LABEL, Components.SplitScreenActivity.LABEL,
Components.SplitScreenActivity.COMPONENT) Components.SplitScreenActivity.COMPONENT.toFlickerComponent())
fun getSecondary(instrumentation: Instrumentation): SplitScreenHelper = fun getSecondary(instrumentation: Instrumentation): SplitScreenHelper =
SplitScreenHelper(instrumentation, SplitScreenHelper(instrumentation,
Components.SplitScreenSecondaryActivity.LABEL, Components.SplitScreenSecondaryActivity.LABEL,
Components.SplitScreenSecondaryActivity.COMPONENT) Components.SplitScreenSecondaryActivity.COMPONENT.toFlickerComponent())
fun getNonResizeable(instrumentation: Instrumentation): SplitScreenHelper = fun getNonResizeable(instrumentation: Instrumentation): SplitScreenHelper =
SplitScreenHelper(instrumentation, SplitScreenHelper(instrumentation,
Components.NonResizeableActivity.LABEL, Components.NonResizeableActivity.LABEL,
Components.NonResizeableActivity.COMPONENT) Components.NonResizeableActivity.COMPONENT.toFlickerComponent())
} }
} }

View File

@@ -16,7 +16,6 @@
package com.android.wm.shell.flicker.legacysplitscreen package com.android.wm.shell.flicker.legacysplitscreen
import android.content.ComponentName
import android.platform.test.annotations.Presubmit import android.platform.test.annotations.Presubmit
import android.view.Surface import android.view.Surface
import android.view.WindowManagerPolicyConstants import android.view.WindowManagerPolicyConstants
@@ -25,13 +24,13 @@ import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group1 import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.navBarWindowIsVisible import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import com.android.wm.shell.flicker.dockedStackDividerBecomesVisible import com.android.wm.shell.flicker.dockedStackDividerBecomesVisible
import com.android.wm.shell.flicker.dockedStackPrimaryBoundsIsVisibleAtEnd import com.android.wm.shell.flicker.dockedStackPrimaryBoundsIsVisibleAtEnd
import com.android.wm.shell.flicker.helpers.SplitScreenHelper import com.android.wm.shell.flicker.helpers.SplitScreenHelper
@@ -50,7 +49,7 @@ import org.junit.runners.Parameterized
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group1 @Group4
class EnterSplitScreenDockActivity( class EnterSplitScreenDockActivity(
testSpec: FlickerTestParameter testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) { ) : LegacySplitScreenTransition(testSpec) {
@@ -62,10 +61,10 @@ class EnterSplitScreenDockActivity(
} }
} }
override val ignoredWindows: List<ComponentName> override val ignoredWindows: List<FlickerComponentName>
get() = listOf(LAUNCHER_COMPONENT, LIVE_WALLPAPER_COMPONENT, get() = listOf(LAUNCHER_COMPONENT, LIVE_WALLPAPER_COMPONENT,
splitScreenApp.component, WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, splitScreenApp.component, FlickerComponentName.SPLASH_SCREEN,
WindowManagerStateHelper.SNAPSHOT_COMPONENT, LAUNCHER_COMPONENT) FlickerComponentName.SNAPSHOT, LAUNCHER_COMPONENT)
@Presubmit @Presubmit
@Test @Test
@@ -89,7 +88,7 @@ class EnterSplitScreenDockActivity(
@Test @Test
fun appWindowIsVisible() { fun appWindowIsVisible() {
testSpec.assertWmEnd { testSpec.assertWmEnd {
isVisible(splitScreenApp.component) isAppWindowVisible(splitScreenApp.component)
} }
} }

View File

@@ -16,16 +16,16 @@
package com.android.wm.shell.flicker.legacysplitscreen package com.android.wm.shell.flicker.legacysplitscreen
import android.content.ComponentName
import android.platform.test.annotations.Presubmit import android.platform.test.annotations.Presubmit
import android.view.Surface import android.view.Surface
import androidx.test.filters.RequiresDevice import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import com.android.wm.shell.flicker.dockedStackDividerIsVisibleAtEnd import com.android.wm.shell.flicker.dockedStackDividerIsVisibleAtEnd
import com.android.wm.shell.flicker.helpers.SplitScreenHelper import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
@@ -43,6 +43,7 @@ import org.junit.runners.Parameterized
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@Group4
class EnterSplitScreenFromDetachedRecentTask( class EnterSplitScreenFromDetachedRecentTask(
testSpec: FlickerTestParameter testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) { ) : LegacySplitScreenTransition(testSpec) {
@@ -62,10 +63,10 @@ class EnterSplitScreenFromDetachedRecentTask(
} }
} }
override val ignoredWindows: List<ComponentName> override val ignoredWindows: List<FlickerComponentName>
get() = listOf(LAUNCHER_COMPONENT, get() = listOf(LAUNCHER_COMPONENT,
WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, FlickerComponentName.SPLASH_SCREEN,
WindowManagerStateHelper.SNAPSHOT_COMPONENT, FlickerComponentName.SNAPSHOT,
splitScreenApp.component) splitScreenApp.component)
@Presubmit @Presubmit
@@ -76,7 +77,7 @@ class EnterSplitScreenFromDetachedRecentTask(
@Test @Test
fun appWindowIsVisible() { fun appWindowIsVisible() {
testSpec.assertWmEnd { testSpec.assertWmEnd {
isVisible(splitScreenApp.component) isAppWindowVisible(splitScreenApp.component)
} }
} }

View File

@@ -16,21 +16,20 @@
package com.android.wm.shell.flicker.legacysplitscreen package com.android.wm.shell.flicker.legacysplitscreen
import android.content.ComponentName
import android.platform.test.annotations.Presubmit import android.platform.test.annotations.Presubmit
import android.view.Surface import android.view.Surface
import androidx.test.filters.RequiresDevice import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group1 import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.helpers.reopenAppFromOverview import com.android.server.wm.flicker.helpers.reopenAppFromOverview
import com.android.server.wm.flicker.navBarWindowIsVisible import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import com.android.wm.shell.flicker.dockedStackDividerBecomesVisible import com.android.wm.shell.flicker.dockedStackDividerBecomesVisible
import com.android.wm.shell.flicker.dockedStackPrimaryBoundsIsVisibleAtEnd import com.android.wm.shell.flicker.dockedStackPrimaryBoundsIsVisibleAtEnd
import com.android.wm.shell.flicker.dockedStackSecondaryBoundsIsVisibleAtEnd import com.android.wm.shell.flicker.dockedStackSecondaryBoundsIsVisibleAtEnd
@@ -49,7 +48,7 @@ import org.junit.runners.Parameterized
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group1 @Group4
class EnterSplitScreenLaunchToSide( class EnterSplitScreenLaunchToSide(
testSpec: FlickerTestParameter testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) { ) : LegacySplitScreenTransition(testSpec) {
@@ -62,10 +61,10 @@ class EnterSplitScreenLaunchToSide(
} }
} }
override val ignoredWindows: List<ComponentName> override val ignoredWindows: List<FlickerComponentName>
get() = listOf(LAUNCHER_COMPONENT, splitScreenApp.component, get() = listOf(LAUNCHER_COMPONENT, splitScreenApp.component,
secondaryApp.component, WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, secondaryApp.component, FlickerComponentName.SPLASH_SCREEN,
WindowManagerStateHelper.SNAPSHOT_COMPONENT) FlickerComponentName.SNAPSHOT)
@Presubmit @Presubmit
@Test @Test
@@ -92,7 +91,7 @@ class EnterSplitScreenLaunchToSide(
// Because we log WM once per frame, sometimes the activity and the window // Because we log WM once per frame, sometimes the activity and the window
// become visible in the same entry, sometimes not, thus it is not possible to // become visible in the same entry, sometimes not, thus it is not possible to
// assert the visibility of the activity here // assert the visibility of the activity here
this.isAppWindowInvisible(secondaryApp.component, ignoreActivity = true) this.isAppWindowInvisible(secondaryApp.component)
.then() .then()
// during re-parenting, the window may disappear and reappear from the // during re-parenting, the window may disappear and reappear from the
// trace, this occurs because we log only 1x per frame // trace, this occurs because we log only 1x per frame

View File

@@ -16,17 +16,16 @@
package com.android.wm.shell.flicker.legacysplitscreen package com.android.wm.shell.flicker.legacysplitscreen
import android.content.ComponentName
import android.platform.test.annotations.Presubmit import android.platform.test.annotations.Presubmit
import android.view.Surface import android.view.Surface
import androidx.test.filters.RequiresDevice import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group1 import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.canSplitScreen import com.android.server.wm.flicker.helpers.canSplitScreen
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import com.android.wm.shell.flicker.dockedStackDividerNotExistsAtEnd import com.android.wm.shell.flicker.dockedStackDividerNotExistsAtEnd
import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig
import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.setSupportsNonResizableMultiWindow import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.setSupportsNonResizableMultiWindow
@@ -51,7 +50,7 @@ import org.junit.runners.Parameterized
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@Group1 @Group4
class EnterSplitScreenNotSupportNonResizable( class EnterSplitScreenNotSupportNonResizable(
testSpec: FlickerTestParameter testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) { ) : LegacySplitScreenTransition(testSpec) {
@@ -71,10 +70,10 @@ class EnterSplitScreenNotSupportNonResizable(
} }
} }
override val ignoredWindows: List<ComponentName> override val ignoredWindows: List<FlickerComponentName>
get() = listOf(LAUNCHER_COMPONENT, get() = listOf(LAUNCHER_COMPONENT,
WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, FlickerComponentName.SPLASH_SCREEN,
WindowManagerStateHelper.SNAPSHOT_COMPONENT, FlickerComponentName.SNAPSHOT,
nonResizeableApp.component, nonResizeableApp.component,
splitScreenApp.component) splitScreenApp.component)

View File

@@ -16,7 +16,6 @@
package com.android.wm.shell.flicker.legacysplitscreen package com.android.wm.shell.flicker.legacysplitscreen
import android.content.ComponentName
import android.platform.test.annotations.Presubmit import android.platform.test.annotations.Presubmit
import android.view.Surface import android.view.Surface
import androidx.test.filters.RequiresDevice import androidx.test.filters.RequiresDevice
@@ -26,7 +25,7 @@ import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group2 import com.android.server.wm.flicker.annotation.Group2
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import com.android.wm.shell.flicker.dockedStackDividerIsVisibleAtEnd import com.android.wm.shell.flicker.dockedStackDividerIsVisibleAtEnd
import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig
import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.setSupportsNonResizableMultiWindow import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.setSupportsNonResizableMultiWindow
@@ -68,12 +67,12 @@ class EnterSplitScreenSupportNonResizable(
} }
} }
override val ignoredWindows: List<ComponentName> override val ignoredWindows: List<FlickerComponentName>
get() = listOf(LAUNCHER_COMPONENT, get() = listOf(LAUNCHER_COMPONENT,
WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, FlickerComponentName.SPLASH_SCREEN,
WindowManagerStateHelper.SNAPSHOT_COMPONENT, FlickerComponentName.SNAPSHOT,
nonResizeableApp.component, nonResizeableApp.component,
splitScreenApp.component) splitScreenApp.component)
@Before @Before
override fun setup() { override fun setup() {
@@ -95,7 +94,7 @@ class EnterSplitScreenSupportNonResizable(
@Test @Test
fun appWindowIsVisible() { fun appWindowIsVisible() {
testSpec.assertWmEnd { testSpec.assertWmEnd {
isVisible(nonResizeableApp.component) isAppWindowVisible(nonResizeableApp.component)
} }
} }

View File

@@ -16,7 +16,6 @@
package com.android.wm.shell.flicker.legacysplitscreen package com.android.wm.shell.flicker.legacysplitscreen
import android.content.ComponentName
import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Postsubmit
import android.view.Surface import android.view.Surface
import androidx.test.filters.FlakyTest import androidx.test.filters.FlakyTest
@@ -30,7 +29,7 @@ import com.android.server.wm.flicker.helpers.exitSplitScreenFromBottom
import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.navBarWindowIsVisible import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER_COMPONENT import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER_COMPONENT
import com.android.wm.shell.flicker.helpers.SplitScreenHelper import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
@@ -70,10 +69,10 @@ class ExitLegacySplitScreenFromBottom(
} }
} }
override val ignoredWindows: List<ComponentName> override val ignoredWindows: List<FlickerComponentName>
get() = listOf(LAUNCHER_COMPONENT, WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, get() = listOf(LAUNCHER_COMPONENT, FlickerComponentName.SPLASH_SCREEN,
splitScreenApp.component, secondaryApp.component, splitScreenApp.component, secondaryApp.component,
WindowManagerStateHelper.SNAPSHOT_COMPONENT) FlickerComponentName.SNAPSHOT)
@Postsubmit @Postsubmit
@Test @Test

View File

@@ -16,7 +16,6 @@
package com.android.wm.shell.flicker.legacysplitscreen package com.android.wm.shell.flicker.legacysplitscreen
import android.content.ComponentName
import android.platform.test.annotations.Presubmit import android.platform.test.annotations.Presubmit
import android.view.Surface import android.view.Surface
import androidx.test.filters.FlakyTest import androidx.test.filters.FlakyTest
@@ -30,7 +29,7 @@ import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.helpers.reopenAppFromOverview import com.android.server.wm.flicker.helpers.reopenAppFromOverview
import com.android.server.wm.flicker.navBarWindowIsVisible import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import com.android.wm.shell.flicker.dockedStackDividerNotExistsAtEnd import com.android.wm.shell.flicker.dockedStackDividerNotExistsAtEnd
import com.android.wm.shell.flicker.helpers.SplitScreenHelper import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
@@ -70,10 +69,10 @@ class ExitPrimarySplitScreenShowSecondaryFullscreen(
} }
} }
override val ignoredWindows: List<ComponentName> override val ignoredWindows: List<FlickerComponentName>
get() = listOf(LAUNCHER_COMPONENT, WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, get() = listOf(LAUNCHER_COMPONENT, FlickerComponentName.SPLASH_SCREEN,
splitScreenApp.component, secondaryApp.component, splitScreenApp.component, secondaryApp.component,
WindowManagerStateHelper.SNAPSHOT_COMPONENT) FlickerComponentName.SNAPSHOT)
@Presubmit @Presubmit
@Test @Test

View File

@@ -16,7 +16,6 @@
package com.android.wm.shell.flicker.legacysplitscreen package com.android.wm.shell.flicker.legacysplitscreen
import android.content.ComponentName
import android.platform.test.annotations.Presubmit import android.platform.test.annotations.Presubmit
import android.view.Surface import android.view.Surface
import androidx.test.filters.RequiresDevice import androidx.test.filters.RequiresDevice
@@ -26,7 +25,7 @@ import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group2 import com.android.server.wm.flicker.annotation.Group2
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER_COMPONENT import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER_COMPONENT
import com.android.wm.shell.flicker.dockedStackDividerNotExistsAtEnd import com.android.wm.shell.flicker.dockedStackDividerNotExistsAtEnd
import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig
@@ -69,11 +68,11 @@ class LegacySplitScreenFromIntentNotSupportNonResizable(
} }
} }
override val ignoredWindows: List<ComponentName> override val ignoredWindows: List<FlickerComponentName>
get() = listOf(DOCKED_STACK_DIVIDER_COMPONENT, LAUNCHER_COMPONENT, LETTERBOX_COMPONENT, get() = listOf(DOCKED_STACK_DIVIDER_COMPONENT, LAUNCHER_COMPONENT, LETTERBOX_COMPONENT,
nonResizeableApp.component, splitScreenApp.component, nonResizeableApp.component, splitScreenApp.component,
WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, FlickerComponentName.SPLASH_SCREEN,
WindowManagerStateHelper.SNAPSHOT_COMPONENT) FlickerComponentName.SNAPSHOT)
@Before @Before
override fun setup() { override fun setup() {
@@ -120,12 +119,12 @@ class LegacySplitScreenFromIntentNotSupportNonResizable(
// when the activity gets PAUSED the window may still be marked as visible // when the activity gets PAUSED the window may still be marked as visible
// it will be updated in the next log entry. This occurs because we record 1x // it will be updated in the next log entry. This occurs because we record 1x
// per frame, thus ignore activity check here // per frame, thus ignore activity check here
this.isAppWindowVisible(splitScreenApp.component, ignoreActivity = true) this.isAppWindowVisible(splitScreenApp.component)
.then() .then()
// immediately after the window (after onResume and before perform relayout) // immediately after the window (after onResume and before perform relayout)
// the activity is invisible. This may or not be logged, since we record 1x // the activity is invisible. This may or not be logged, since we record 1x
// per frame, thus ignore activity check here // per frame, thus ignore activity check here
.isAppWindowInvisible(splitScreenApp.component, ignoreActivity = true) .isAppWindowInvisible(splitScreenApp.component)
} }
} }
@@ -142,13 +141,12 @@ class LegacySplitScreenFromIntentNotSupportNonResizable(
.then() .then()
// we log once per frame, upon logging, window may be visible or not depending // we log once per frame, upon logging, window may be visible or not depending
// on what was processed until that moment. Both behaviors are correct // on what was processed until that moment. Both behaviors are correct
.isAppWindowInvisible(nonResizeableApp.component, .isAppWindowInvisible(nonResizeableApp.component, isOptional = true)
ignoreActivity = true, isOptional = true)
.then() .then()
// immediately after the window (after onResume and before perform relayout) // immediately after the window (after onResume and before perform relayout)
// the activity is invisible. This may or not be logged, since we record 1x // the activity is invisible. This may or not be logged, since we record 1x
// per frame, thus ignore activity check here // per frame, thus ignore activity check here
.isAppWindowVisible(nonResizeableApp.component, ignoreActivity = true) .isAppWindowVisible(nonResizeableApp.component)
} }
} }
@@ -159,7 +157,7 @@ class LegacySplitScreenFromIntentNotSupportNonResizable(
@Test @Test
fun nonResizableAppWindowBecomesVisibleAtEnd() { fun nonResizableAppWindowBecomesVisibleAtEnd() {
testSpec.assertWmEnd { testSpec.assertWmEnd {
this.isVisible(nonResizeableApp.component) isAppWindowVisible(nonResizeableApp.component)
} }
} }
@@ -171,8 +169,8 @@ class LegacySplitScreenFromIntentNotSupportNonResizable(
@Test @Test
fun onlyNonResizableAppWindowIsVisibleAtEnd() { fun onlyNonResizableAppWindowIsVisibleAtEnd() {
testSpec.assertWmEnd { testSpec.assertWmEnd {
isInvisible(splitScreenApp.component) isAppWindowInvisible(splitScreenApp.component)
isVisible(nonResizeableApp.component) isAppWindowVisible(nonResizeableApp.component)
} }
} }

View File

@@ -16,7 +16,6 @@
package com.android.wm.shell.flicker.legacysplitscreen package com.android.wm.shell.flicker.legacysplitscreen
import android.content.ComponentName
import android.platform.test.annotations.Presubmit import android.platform.test.annotations.Presubmit
import android.view.Surface import android.view.Surface
import androidx.test.filters.RequiresDevice import androidx.test.filters.RequiresDevice
@@ -26,7 +25,7 @@ import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group2 import com.android.server.wm.flicker.annotation.Group2
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER_COMPONENT import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER_COMPONENT
import com.android.wm.shell.flicker.dockedStackDividerIsVisibleAtEnd import com.android.wm.shell.flicker.dockedStackDividerIsVisibleAtEnd
import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig
@@ -69,11 +68,11 @@ class LegacySplitScreenFromIntentSupportNonResizable(
} }
} }
override val ignoredWindows: List<ComponentName> override val ignoredWindows: List<FlickerComponentName>
get() = listOf(DOCKED_STACK_DIVIDER_COMPONENT, LAUNCHER_COMPONENT, LETTERBOX_COMPONENT, get() = listOf(DOCKED_STACK_DIVIDER_COMPONENT, LAUNCHER_COMPONENT, LETTERBOX_COMPONENT,
nonResizeableApp.component, splitScreenApp.component, nonResizeableApp.component, splitScreenApp.component,
WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, FlickerComponentName.SPLASH_SCREEN,
WindowManagerStateHelper.SNAPSHOT_COMPONENT) FlickerComponentName.SNAPSHOT)
@Before @Before
override fun setup() { override fun setup() {
@@ -110,13 +109,12 @@ class LegacySplitScreenFromIntentSupportNonResizable(
.then() .then()
// we log once per frame, upon logging, window may be visible or not depending // we log once per frame, upon logging, window may be visible or not depending
// on what was processed until that moment. Both behaviors are correct // on what was processed until that moment. Both behaviors are correct
.isAppWindowInvisible(nonResizeableApp.component, .isAppWindowInvisible(nonResizeableApp.component, isOptional = true)
ignoreActivity = true, isOptional = true)
.then() .then()
// immediately after the window (after onResume and before perform relayout) // immediately after the window (after onResume and before perform relayout)
// the activity is invisible. This may or not be logged, since we record 1x // the activity is invisible. This may or not be logged, since we record 1x
// per frame, thus ignore activity check here // per frame, thus ignore activity check here
.isAppWindowVisible(nonResizeableApp.component, ignoreActivity = true) .isAppWindowVisible(nonResizeableApp.component)
} }
} }
@@ -128,8 +126,8 @@ class LegacySplitScreenFromIntentSupportNonResizable(
@Test @Test
fun bothAppsWindowsAreVisibleAtEnd() { fun bothAppsWindowsAreVisibleAtEnd() {
testSpec.assertWmEnd { testSpec.assertWmEnd {
isVisible(splitScreenApp.component) isAppWindowVisible(splitScreenApp.component)
isVisible(nonResizeableApp.component) isAppWindowVisible(nonResizeableApp.component)
} }
} }

View File

@@ -16,7 +16,6 @@
package com.android.wm.shell.flicker.legacysplitscreen package com.android.wm.shell.flicker.legacysplitscreen
import android.content.ComponentName
import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit import android.platform.test.annotations.Presubmit
import android.view.Surface import android.view.Surface
@@ -28,7 +27,7 @@ import com.android.server.wm.flicker.annotation.Group2
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.helpers.reopenAppFromOverview import com.android.server.wm.flicker.helpers.reopenAppFromOverview
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER_COMPONENT import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER_COMPONENT
import com.android.wm.shell.flicker.dockedStackDividerNotExistsAtEnd import com.android.wm.shell.flicker.dockedStackDividerNotExistsAtEnd
import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig
@@ -71,11 +70,11 @@ class LegacySplitScreenFromRecentNotSupportNonResizable(
} }
} }
override val ignoredWindows: List<ComponentName> override val ignoredWindows: List<FlickerComponentName>
get() = listOf(DOCKED_STACK_DIVIDER_COMPONENT, LAUNCHER_COMPONENT, LETTERBOX_COMPONENT, get() = listOf(DOCKED_STACK_DIVIDER_COMPONENT, LAUNCHER_COMPONENT, LETTERBOX_COMPONENT,
TOAST_COMPONENT, splitScreenApp.component, nonResizeableApp.component, TOAST_COMPONENT, splitScreenApp.component, nonResizeableApp.component,
WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, FlickerComponentName.SPLASH_SCREEN,
WindowManagerStateHelper.SNAPSHOT_COMPONENT) FlickerComponentName.SNAPSHOT)
@Before @Before
override fun setup() { override fun setup() {
@@ -116,12 +115,12 @@ class LegacySplitScreenFromRecentNotSupportNonResizable(
// when the activity gets PAUSED the window may still be marked as visible // when the activity gets PAUSED the window may still be marked as visible
// it will be updated in the next log entry. This occurs because we record 1x // it will be updated in the next log entry. This occurs because we record 1x
// per frame, thus ignore activity check here // per frame, thus ignore activity check here
this.isAppWindowVisible(splitScreenApp.component, ignoreActivity = true) this.isAppWindowVisible(splitScreenApp.component)
.then() .then()
// immediately after the window (after onResume and before perform relayout) // immediately after the window (after onResume and before perform relayout)
// the activity is invisible. This may or not be logged, since we record 1x // the activity is invisible. This may or not be logged, since we record 1x
// per frame, thus ignore activity check here // per frame, thus ignore activity check here
.isAppWindowInvisible(splitScreenApp.component, ignoreActivity = true) .isAppWindowInvisible(splitScreenApp.component)
} }
} }
@@ -143,8 +142,8 @@ class LegacySplitScreenFromRecentNotSupportNonResizable(
@Test @Test
fun onlyNonResizableAppWindowIsVisibleAtEnd() { fun onlyNonResizableAppWindowIsVisibleAtEnd() {
testSpec.assertWmEnd { testSpec.assertWmEnd {
isInvisible(splitScreenApp.component) isAppWindowInvisible(splitScreenApp.component)
isVisible(nonResizeableApp.component) isAppWindowVisible(nonResizeableApp.component)
} }
} }

View File

@@ -16,7 +16,6 @@
package com.android.wm.shell.flicker.legacysplitscreen package com.android.wm.shell.flicker.legacysplitscreen
import android.content.ComponentName
import android.platform.test.annotations.Presubmit import android.platform.test.annotations.Presubmit
import android.view.Surface import android.view.Surface
import androidx.test.filters.RequiresDevice import androidx.test.filters.RequiresDevice
@@ -27,7 +26,7 @@ import com.android.server.wm.flicker.annotation.Group2
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.helpers.reopenAppFromOverview import com.android.server.wm.flicker.helpers.reopenAppFromOverview
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER_COMPONENT import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER_COMPONENT
import com.android.wm.shell.flicker.dockedStackDividerIsVisibleAtEnd import com.android.wm.shell.flicker.dockedStackDividerIsVisibleAtEnd
import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig
@@ -70,11 +69,11 @@ class LegacySplitScreenFromRecentSupportNonResizable(
} }
} }
override val ignoredWindows: List<ComponentName> override val ignoredWindows: List<FlickerComponentName>
get() = listOf(DOCKED_STACK_DIVIDER_COMPONENT, LAUNCHER_COMPONENT, LETTERBOX_COMPONENT, get() = listOf(DOCKED_STACK_DIVIDER_COMPONENT, LAUNCHER_COMPONENT, LETTERBOX_COMPONENT,
TOAST_COMPONENT, splitScreenApp.component, nonResizeableApp.component, TOAST_COMPONENT, splitScreenApp.component, nonResizeableApp.component,
WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, FlickerComponentName.SPLASH_SCREEN,
WindowManagerStateHelper.SNAPSHOT_COMPONENT) FlickerComponentName.SNAPSHOT)
@Before @Before
override fun setup() { override fun setup() {
@@ -107,7 +106,7 @@ class LegacySplitScreenFromRecentSupportNonResizable(
// Because we log WM once per frame, sometimes the activity and the window // Because we log WM once per frame, sometimes the activity and the window
// become visible in the same entry, sometimes not, thus it is not possible to // become visible in the same entry, sometimes not, thus it is not possible to
// assert the visibility of the activity here // assert the visibility of the activity here
this.isAppWindowInvisible(nonResizeableApp.component, ignoreActivity = true) this.isAppWindowInvisible(nonResizeableApp.component)
.then() .then()
// during re-parenting, the window may disappear and reappear from the // during re-parenting, the window may disappear and reappear from the
// trace, this occurs because we log only 1x per frame // trace, this occurs because we log only 1x per frame
@@ -129,8 +128,8 @@ class LegacySplitScreenFromRecentSupportNonResizable(
@Test @Test
fun bothAppsWindowsAreVisibleAtEnd() { fun bothAppsWindowsAreVisibleAtEnd() {
testSpec.assertWmEnd { testSpec.assertWmEnd {
isVisible(splitScreenApp.component) isAppWindowVisible(splitScreenApp.component)
isVisible(nonResizeableApp.component) isAppWindowVisible(nonResizeableApp.component)
} }
} }

View File

@@ -16,7 +16,6 @@
package com.android.wm.shell.flicker.legacysplitscreen package com.android.wm.shell.flicker.legacysplitscreen
import android.content.ComponentName
import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit import android.platform.test.annotations.Presubmit
import android.view.Surface import android.view.Surface
@@ -39,7 +38,7 @@ import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import com.android.wm.shell.flicker.dockedStackDividerBecomesInvisible import com.android.wm.shell.flicker.dockedStackDividerBecomesInvisible
import com.android.wm.shell.flicker.helpers.SimpleAppHelper import com.android.wm.shell.flicker.helpers.SimpleAppHelper
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
@@ -86,9 +85,9 @@ class LegacySplitScreenToLauncher(
} }
} }
override val ignoredWindows: List<ComponentName> override val ignoredWindows: List<FlickerComponentName>
get() = listOf(LAUNCHER_COMPONENT, WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, get() = listOf(LAUNCHER_COMPONENT, FlickerComponentName.SPLASH_SCREEN,
WindowManagerStateHelper.SNAPSHOT_COMPONENT) FlickerComponentName.SNAPSHOT)
@Presubmit @Presubmit
@Test @Test

View File

@@ -17,7 +17,6 @@
package com.android.wm.shell.flicker.legacysplitscreen package com.android.wm.shell.flicker.legacysplitscreen
import android.app.Instrumentation import android.app.Instrumentation
import android.content.ComponentName
import android.content.Context import android.content.Context
import android.support.test.launcherhelper.LauncherStrategyFactory import android.support.test.launcherhelper.LauncherStrategyFactory
import android.view.Surface import android.view.Surface
@@ -32,7 +31,7 @@ import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
import com.android.server.wm.flicker.repetitions import com.android.server.wm.flicker.repetitions
import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.startRotation
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import com.android.wm.shell.flicker.helpers.BaseAppHelper.Companion.isShellTransitionsEnabled import com.android.wm.shell.flicker.helpers.BaseAppHelper.Companion.isShellTransitionsEnabled
import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.getDevEnableNonResizableMultiWindow import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.getDevEnableNonResizableMultiWindow
import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.setDevEnableNonResizableMultiWindow import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.setDevEnableNonResizableMultiWindow
@@ -50,7 +49,7 @@ abstract class LegacySplitScreenTransition(protected val testSpec: FlickerTestPa
protected val splitScreenApp = SplitScreenHelper.getPrimary(instrumentation) protected val splitScreenApp = SplitScreenHelper.getPrimary(instrumentation)
protected val secondaryApp = SplitScreenHelper.getSecondary(instrumentation) protected val secondaryApp = SplitScreenHelper.getSecondary(instrumentation)
protected val nonResizeableApp = SplitScreenHelper.getNonResizeable(instrumentation) protected val nonResizeableApp = SplitScreenHelper.getNonResizeable(instrumentation)
protected val LAUNCHER_COMPONENT = ComponentName("", protected val LAUNCHER_COMPONENT = FlickerComponentName("",
LauncherStrategyFactory.getInstance(instrumentation) LauncherStrategyFactory.getInstance(instrumentation)
.launcherStrategy.supportedLauncherPackage) .launcherStrategy.supportedLauncherPackage)
private var prevDevEnableNonResizableMultiWindow = 0 private var prevDevEnableNonResizableMultiWindow = 0
@@ -79,9 +78,9 @@ abstract class LegacySplitScreenTransition(protected val testSpec: FlickerTestPa
* *
* b/182720234 * b/182720234
*/ */
open val ignoredWindows: List<ComponentName> = listOf( open val ignoredWindows: List<FlickerComponentName> = listOf(
WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, FlickerComponentName.SPLASH_SCREEN,
WindowManagerStateHelper.SNAPSHOT_COMPONENT) FlickerComponentName.SNAPSHOT)
protected open val transition: FlickerBuilder.(Map<String, Any?>) -> Unit protected open val transition: FlickerBuilder.(Map<String, Any?>) -> Unit
get() = { configuration -> get() = { configuration ->
@@ -148,9 +147,9 @@ abstract class LegacySplitScreenTransition(protected val testSpec: FlickerTestPa
} }
companion object { companion object {
internal val LIVE_WALLPAPER_COMPONENT = ComponentName("", internal val LIVE_WALLPAPER_COMPONENT = FlickerComponentName("",
"com.breel.wallpapers18.soundviz.wallpaper.variations.SoundVizWallpaperV2") "com.breel.wallpapers18.soundviz.wallpaper.variations.SoundVizWallpaperV2")
internal val LETTERBOX_COMPONENT = ComponentName("", "Letterbox") internal val LETTERBOX_COMPONENT = FlickerComponentName("", "Letterbox")
internal val TOAST_COMPONENT = ComponentName("", "Toast") internal val TOAST_COMPONENT = FlickerComponentName("", "Toast")
} }
} }

View File

@@ -16,7 +16,6 @@
package com.android.wm.shell.flicker.legacysplitscreen package com.android.wm.shell.flicker.legacysplitscreen
import android.content.ComponentName
import android.platform.test.annotations.Presubmit import android.platform.test.annotations.Presubmit
import android.view.Surface import android.view.Surface
import androidx.test.filters.FlakyTest import androidx.test.filters.FlakyTest
@@ -29,7 +28,7 @@ import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.entireScreenCovered import com.android.server.wm.flicker.entireScreenCovered
import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import com.android.wm.shell.flicker.appPairsDividerBecomesVisible import com.android.wm.shell.flicker.appPairsDividerBecomesVisible
import com.android.wm.shell.flicker.helpers.SplitScreenHelper import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
@@ -59,10 +58,10 @@ class OpenAppToLegacySplitScreen(
} }
} }
override val ignoredWindows: List<ComponentName> override val ignoredWindows: List<FlickerComponentName>
get() = listOf(LAUNCHER_COMPONENT, splitScreenApp.component, get() = listOf(LAUNCHER_COMPONENT, splitScreenApp.component,
WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, FlickerComponentName.SPLASH_SCREEN,
WindowManagerStateHelper.SNAPSHOT_COMPONENT) FlickerComponentName.SNAPSHOT)
@FlakyTest @FlakyTest
@Test @Test

View File

@@ -42,6 +42,7 @@ import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER_COMPONENT import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER_COMPONENT
import com.android.wm.shell.flicker.helpers.SimpleAppHelper import com.android.wm.shell.flicker.helpers.SimpleAppHelper
import com.android.wm.shell.flicker.testapp.Components import com.android.wm.shell.flicker.testapp.Components
@@ -110,7 +111,7 @@ class ResizeLegacySplitScreen(
@Test @Test
fun topAppWindowIsAlwaysVisible() { fun topAppWindowIsAlwaysVisible() {
testSpec.assertWm { testSpec.assertWm {
this.isAppWindowVisible(Components.SimpleActivity.COMPONENT) this.isAppWindowVisible(Components.SimpleActivity.COMPONENT.toFlickerComponent())
} }
} }
@@ -118,7 +119,7 @@ class ResizeLegacySplitScreen(
@Test @Test
fun bottomAppWindowIsAlwaysVisible() { fun bottomAppWindowIsAlwaysVisible() {
testSpec.assertWm { testSpec.assertWm {
this.isAppWindowVisible(Components.ImeActivity.COMPONENT) this.isAppWindowVisible(Components.ImeActivity.COMPONENT.toFlickerComponent())
} }
} }
@@ -142,14 +143,14 @@ class ResizeLegacySplitScreen(
@Test @Test
fun topAppLayerIsAlwaysVisible() { fun topAppLayerIsAlwaysVisible() {
testSpec.assertLayers { testSpec.assertLayers {
this.isVisible(Components.SimpleActivity.COMPONENT) this.isVisible(Components.SimpleActivity.COMPONENT.toFlickerComponent())
} }
} }
@Test @Test
fun bottomAppLayerIsAlwaysVisible() { fun bottomAppLayerIsAlwaysVisible() {
testSpec.assertLayers { testSpec.assertLayers {
this.isVisible(Components.ImeActivity.COMPONENT) this.isVisible(Components.ImeActivity.COMPONENT.toFlickerComponent())
} }
} }
@@ -174,8 +175,10 @@ class ResizeLegacySplitScreen(
dividerBounds.bottom - WindowUtils.dockedStackDividerInset, dividerBounds.bottom - WindowUtils.dockedStackDividerInset,
displayBounds.right, displayBounds.right,
displayBounds.bottom - WindowUtils.navigationBarHeight) displayBounds.bottom - WindowUtils.navigationBarHeight)
visibleRegion(Components.SimpleActivity.COMPONENT).coversExactly(topAppBounds) visibleRegion(Components.SimpleActivity.COMPONENT.toFlickerComponent())
visibleRegion(Components.ImeActivity.COMPONENT).coversExactly(bottomAppBounds) .coversExactly(topAppBounds)
visibleRegion(Components.ImeActivity.COMPONENT.toFlickerComponent())
.coversExactly(bottomAppBounds)
} }
} }
@@ -194,8 +197,10 @@ class ResizeLegacySplitScreen(
displayBounds.right, displayBounds.right,
displayBounds.bottom - WindowUtils.navigationBarHeight) displayBounds.bottom - WindowUtils.navigationBarHeight)
visibleRegion(Components.SimpleActivity.COMPONENT).coversExactly(topAppBounds) visibleRegion(Components.SimpleActivity.COMPONENT.toFlickerComponent())
visibleRegion(Components.ImeActivity.COMPONENT).coversExactly(bottomAppBounds) .coversExactly(topAppBounds)
visibleRegion(Components.ImeActivity.COMPONENT.toFlickerComponent())
.coversExactly(bottomAppBounds)
} }
} }

View File

@@ -101,7 +101,7 @@ class RotateTwoLaunchedAppAndEnterSplitScreen(
// Because we log WM once per frame, sometimes the activity and the window // Because we log WM once per frame, sometimes the activity and the window
// become visible in the same entry, sometimes not, thus it is not possible to // become visible in the same entry, sometimes not, thus it is not possible to
// assert the visibility of the activity here // assert the visibility of the activity here
this.isAppWindowInvisible(secondaryApp.component, ignoreActivity = true) this.isAppWindowInvisible(secondaryApp.component)
.then() .then()
// during re-parenting, the window may disappear and reappear from the // during re-parenting, the window may disappear and reappear from the
// trace, this occurs because we log only 1x per frame // trace, this occurs because we log only 1x per frame

View File

@@ -14,6 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
@file:JvmName("CommonAssertions")
package com.android.wm.shell.flicker.pip package com.android.wm.shell.flicker.pip
internal const val PIP_WINDOW_COMPONENT = "PipMenuActivity" internal const val PIP_WINDOW_COMPONENT = "PipMenuActivity"

View File

@@ -26,7 +26,6 @@ import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.LAUNCHER_COMPONENT import com.android.server.wm.flicker.LAUNCHER_COMPONENT
import com.android.server.wm.flicker.annotation.Group3 import com.android.server.wm.flicker.annotation.Group3
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.traces.parser.toLayerName
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View File

@@ -29,7 +29,7 @@ import com.android.server.wm.flicker.entireScreenCovered
import com.android.server.wm.flicker.helpers.WindowUtils import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.navBarLayerRotatesAndScales import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import com.android.wm.shell.flicker.helpers.FixedAppHelper import com.android.wm.shell.flicker.helpers.FixedAppHelper
import com.android.wm.shell.flicker.pip.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_LANDSCAPE import com.android.wm.shell.flicker.pip.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_LANDSCAPE
import com.android.wm.shell.flicker.pip.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_PORTRAIT import com.android.wm.shell.flicker.pip.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_PORTRAIT
@@ -106,7 +106,7 @@ class EnterPipToOtherOrientationTest(
} }
/** /**
* Checks that the [WindowManagerStateHelper.NAV_BAR_COMPONENT] has the correct position at * Checks that the [FlickerComponentName.NAV_BAR] has the correct position at
* the start and end of the transition * the start and end of the transition
*/ */
@FlakyTest @FlakyTest
@@ -115,7 +115,7 @@ class EnterPipToOtherOrientationTest(
testSpec.navBarLayerRotatesAndScales(Surface.ROTATION_90, Surface.ROTATION_0) testSpec.navBarLayerRotatesAndScales(Surface.ROTATION_90, Surface.ROTATION_0)
/** /**
* Checks that the [WindowManagerStateHelper.STATUS_BAR_COMPONENT] has the correct position at * Checks that the [FlickerComponentName.STATUS_BAR] has the correct position at
* the start and end of the transition * the start and end of the transition
*/ */
@Presubmit @Presubmit
@@ -150,7 +150,7 @@ class EnterPipToOtherOrientationTest(
@Test @Test
fun testAppWindowInvisibleOnStart() { fun testAppWindowInvisibleOnStart() {
testSpec.assertWmStart { testSpec.assertWmStart {
isInvisible(testApp.component) isAppWindowInvisible(testApp.component)
} }
} }
@@ -161,7 +161,7 @@ class EnterPipToOtherOrientationTest(
@Test @Test
fun testAppWindowVisibleOnEnd() { fun testAppWindowVisibleOnEnd() {
testSpec.assertWmEnd { testSpec.assertWmEnd {
isVisible(testApp.component) isAppWindowVisible(testApp.component)
} }
} }

View File

@@ -18,7 +18,6 @@ package com.android.wm.shell.flicker.pip
import android.platform.test.annotations.Presubmit import android.platform.test.annotations.Presubmit
import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.traces.parser.toLayerName
import com.android.wm.shell.flicker.helpers.FixedAppHelper import com.android.wm.shell.flicker.helpers.FixedAppHelper
import org.junit.Test import org.junit.Test
@@ -63,7 +62,7 @@ abstract class ExitPipToAppTransition(testSpec: FlickerTestParameter) : PipTrans
// when the activity is STOPPING, sometimes it becomes invisible in an entry before // when the activity is STOPPING, sometimes it becomes invisible in an entry before
// the window, sometimes in the same entry. This occurs because we log 1x per frame // the window, sometimes in the same entry. This occurs because we log 1x per frame
// thus we ignore activity here // thus we ignore activity here
isAppWindowVisible(testApp.component, ignoreActivity = true) isAppWindowVisible(testApp.component)
.isAppWindowOnTop(pipApp.component) .isAppWindowOnTop(pipApp.component)
.then() .then()
.isAppWindowInvisible(testApp.component) .isAppWindowInvisible(testApp.component)

View File

@@ -54,9 +54,9 @@ abstract class ExitPipTransition(testSpec: FlickerTestParameter) : PipTransition
open fun pipWindowBecomesInvisible() { open fun pipWindowBecomesInvisible() {
testSpec.assertWm { testSpec.assertWm {
this.invoke("hasPipWindow") { this.invoke("hasPipWindow") {
it.isPinned(pipApp.component).isVisible(pipApp.component) it.isPinned(pipApp.component).isAppWindowVisible(pipApp.component)
}.then().invoke("!hasPipWindow") { }.then().invoke("!hasPipWindow") {
it.isNotPinned(pipApp.component).isInvisible(pipApp.component) it.isNotPinned(pipApp.component).isAppWindowInvisible(pipApp.component)
} }
} }
} }

View File

@@ -23,7 +23,6 @@ import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group3 import com.android.server.wm.flicker.annotation.Group3
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.traces.parser.toWindowName
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.junit.runners.MethodSorters import org.junit.runners.MethodSorters

View File

@@ -23,7 +23,6 @@ import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group3 import com.android.server.wm.flicker.annotation.Group3
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.traces.parser.toWindowName
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.junit.runners.MethodSorters import org.junit.runners.MethodSorters

View File

@@ -27,7 +27,6 @@ import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.LAUNCHER_COMPONENT import com.android.server.wm.flicker.LAUNCHER_COMPONENT
import com.android.server.wm.flicker.annotation.Group3 import com.android.server.wm.flicker.annotation.Group3
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.traces.parser.toLayerName
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View File

@@ -20,8 +20,6 @@ import android.platform.test.annotations.Presubmit
import com.android.launcher3.tapl.LauncherInstrumentation import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.traces.RegionSubject import com.android.server.wm.flicker.traces.RegionSubject
import com.android.server.wm.traces.parser.toLayerName
import com.android.server.wm.traces.parser.toWindowName
import com.android.wm.shell.flicker.helpers.FixedAppHelper import com.android.wm.shell.flicker.helpers.FixedAppHelper
import org.junit.Test import org.junit.Test

View File

@@ -22,12 +22,12 @@ import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group3 import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.WindowUtils import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.helpers.setRotation import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.startRotation
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import com.android.wm.shell.flicker.helpers.ImeAppHelper import com.android.wm.shell.flicker.helpers.ImeAppHelper
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.Test import org.junit.Test
@@ -43,7 +43,7 @@ import org.junit.runners.Parameterized
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group3 @Group4
class PipKeyboardTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) { class PipKeyboardTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) {
private val imeApp = ImeAppHelper(instrumentation) private val imeApp = ImeAppHelper(instrumentation)
@@ -90,7 +90,7 @@ class PipKeyboardTest(testSpec: FlickerTestParameter) : PipTransition(testSpec)
@Test @Test
fun pipIsAboveAppWindow() { fun pipIsAboveAppWindow() {
testSpec.assertWmTag(TAG_IME_VISIBLE) { testSpec.assertWmTag(TAG_IME_VISIBLE) {
isAboveWindow(WindowManagerStateHelper.IME_COMPONENT, pipApp.component) isAboveWindow(FlickerComponentName.IME, pipApp.component)
} }
} }

View File

@@ -23,7 +23,7 @@ import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group3 import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
@@ -51,7 +51,7 @@ import org.junit.runners.Parameterized
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group3 @Group4
class PipLegacySplitScreenTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) { class PipLegacySplitScreenTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) {
private val imeApp = ImeAppHelper(instrumentation) private val imeApp = ImeAppHelper(instrumentation)
private val testApp = FixedAppHelper(instrumentation) private val testApp = FixedAppHelper(instrumentation)
@@ -104,9 +104,9 @@ class PipLegacySplitScreenTest(testSpec: FlickerTestParameter) : PipTransition(t
@Test @Test
fun bothAppWindowsVisible() { fun bothAppWindowsVisible() {
testSpec.assertWmEnd { testSpec.assertWmEnd {
isVisible(testApp.component) isAppWindowVisible(testApp.component)
isVisible(imeApp.component) isAppWindowVisible(imeApp.component)
noWindowsOverlap(testApp.component, imeApp.component) doNotOverlap(testApp.component, imeApp.component)
} }
} }

View File

@@ -23,7 +23,7 @@ import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group3 import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.endRotation import com.android.server.wm.flicker.endRotation
import com.android.server.wm.flicker.entireScreenCovered import com.android.server.wm.flicker.entireScreenCovered
@@ -62,7 +62,7 @@ import org.junit.runners.Parameterized
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group3 @Group4
class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) { class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) {
private val fixedApp = FixedAppHelper(instrumentation) private val fixedApp = FixedAppHelper(instrumentation)
private val screenBoundsStart = WindowUtils.getDisplayBounds(testSpec.config.startRotation) private val screenBoundsStart = WindowUtils.getDisplayBounds(testSpec.config.startRotation)

View File

@@ -22,7 +22,7 @@ import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group3 import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.WindowUtils import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.wm.shell.flicker.pip.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_LANDSCAPE import com.android.wm.shell.flicker.pip.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_LANDSCAPE
@@ -43,7 +43,7 @@ import org.junit.runners.Parameterized
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group3 @Group4
class SetRequestedOrientationWhilePinnedTest( class SetRequestedOrientationWhilePinnedTest(
testSpec: FlickerTestParameter testSpec: FlickerTestParameter
) : PipTransition(testSpec) { ) : PipTransition(testSpec) {

View File

@@ -28,6 +28,8 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMAR
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY; import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
import static android.app.WindowConfiguration.activityTypeToString; import static android.app.WindowConfiguration.activityTypeToString;
import static android.app.WindowConfiguration.windowingModeToString; import static android.app.WindowConfiguration.windowingModeToString;
import static android.app.WindowConfigurationProto.WINDOWING_MODE;
import static android.content.ConfigurationProto.WINDOW_CONFIGURATION;
import static com.android.server.wm.ConfigurationContainerProto.FULL_CONFIGURATION; import static com.android.server.wm.ConfigurationContainerProto.FULL_CONFIGURATION;
import static com.android.server.wm.ConfigurationContainerProto.MERGED_OVERRIDE_CONFIGURATION; import static com.android.server.wm.ConfigurationContainerProto.MERGED_OVERRIDE_CONFIGURATION;
@@ -695,22 +697,40 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> {
@CallSuper @CallSuper
protected void dumpDebug(ProtoOutputStream proto, long fieldId, protected void dumpDebug(ProtoOutputStream proto, long fieldId,
@WindowTraceLogLevel int logLevel) { @WindowTraceLogLevel int logLevel) {
// Critical log level logs only visible elements to mitigate performance overheard final long token = proto.start(fieldId);
if (logLevel != WindowTraceLogLevel.ALL && !mHasOverrideConfiguration) {
return; if (logLevel == WindowTraceLogLevel.ALL || mHasOverrideConfiguration) {
mRequestedOverrideConfiguration.dumpDebug(proto, OVERRIDE_CONFIGURATION,
logLevel == WindowTraceLogLevel.CRITICAL);
} }
final long token = proto.start(fieldId); // Unless trace level is set to `WindowTraceLogLevel.ALL` don't dump anything that isn't
mRequestedOverrideConfiguration.dumpDebug(proto, OVERRIDE_CONFIGURATION, // required to mitigate performance overhead
logLevel == WindowTraceLogLevel.CRITICAL);
if (logLevel == WindowTraceLogLevel.ALL) { if (logLevel == WindowTraceLogLevel.ALL) {
mFullConfiguration.dumpDebug(proto, FULL_CONFIGURATION, false /* critical */); mFullConfiguration.dumpDebug(proto, FULL_CONFIGURATION, false /* critical */);
mMergedOverrideConfiguration.dumpDebug(proto, MERGED_OVERRIDE_CONFIGURATION, mMergedOverrideConfiguration.dumpDebug(proto, MERGED_OVERRIDE_CONFIGURATION,
false /* critical */); false /* critical */);
} }
if (logLevel == WindowTraceLogLevel.TRIM) {
// Required for Fass to automatically detect pip transitions in Winscope traces
dumpDebugWindowingMode(proto);
}
proto.end(token); proto.end(token);
} }
private void dumpDebugWindowingMode(ProtoOutputStream proto) {
final long fullConfigToken = proto.start(FULL_CONFIGURATION);
final long windowConfigToken = proto.start(WINDOW_CONFIGURATION);
int windowingMode = mFullConfiguration.windowConfiguration.getWindowingMode();
proto.write(WINDOWING_MODE, windowingMode);
proto.end(windowConfigToken);
proto.end(fullConfigToken);
}
/** /**
* Dumps the names of this container children in the input print writer indenting each * Dumps the names of this container children in the input print writer indenting each
* level with the input prefix. * level with the input prefix.

View File

@@ -57,6 +57,7 @@ import static com.android.server.wm.WindowContainerProto.CONFIGURATION_CONTAINER
import static com.android.server.wm.WindowContainerProto.IDENTIFIER; import static com.android.server.wm.WindowContainerProto.IDENTIFIER;
import static com.android.server.wm.WindowContainerProto.ORIENTATION; import static com.android.server.wm.WindowContainerProto.ORIENTATION;
import static com.android.server.wm.WindowContainerProto.SURFACE_ANIMATOR; import static com.android.server.wm.WindowContainerProto.SURFACE_ANIMATOR;
import static com.android.server.wm.WindowContainerProto.SURFACE_CONTROL;
import static com.android.server.wm.WindowContainerProto.VISIBLE; import static com.android.server.wm.WindowContainerProto.VISIBLE;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ANIM; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ANIM;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
@@ -2429,6 +2430,9 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
if (mSurfaceAnimator.isAnimating()) { if (mSurfaceAnimator.isAnimating()) {
mSurfaceAnimator.dumpDebug(proto, SURFACE_ANIMATOR); mSurfaceAnimator.dumpDebug(proto, SURFACE_ANIMATOR);
} }
if (mSurfaceControl != null) {
mSurfaceControl.dumpDebug(proto, SURFACE_CONTROL);
}
// add children to proto // add children to proto
for (int i = 0; i < getChildCount(); i++) { for (int i = 0; i < getChildCount(); i++) {

View File

@@ -17,22 +17,29 @@
@file:JvmName("CommonAssertions") @file:JvmName("CommonAssertions")
package com.android.server.wm.flicker package com.android.server.wm.flicker
import android.content.ComponentName
import com.android.server.wm.flicker.helpers.WindowUtils import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
val LAUNCHER_COMPONENT = ComponentName("com.google.android.apps.nexuslauncher", val LAUNCHER_COMPONENT = FlickerComponentName("com.google.android.apps.nexuslauncher",
"com.google.android.apps.nexuslauncher.NexusLauncherActivity") "com.google.android.apps.nexuslauncher.NexusLauncherActivity")
/**
* Checks that [FlickerComponentName.STATUS_BAR] window is visible and above the app windows in
* all WM trace entries
*/
fun FlickerTestParameter.statusBarWindowIsVisible() { fun FlickerTestParameter.statusBarWindowIsVisible() {
assertWm { assertWm {
this.isAboveAppWindowVisible(WindowManagerStateHelper.STATUS_BAR_COMPONENT) this.isAboveAppWindowVisible(FlickerComponentName.STATUS_BAR)
} }
} }
/**
* Checks that [FlickerComponentName.NAV_BAR] window is visible and above the app windows in
* all WM trace entries
*/
fun FlickerTestParameter.navBarWindowIsVisible() { fun FlickerTestParameter.navBarWindowIsVisible() {
assertWm { assertWm {
this.isAboveAppWindowVisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) this.isAboveAppWindowVisible(FlickerComponentName.NAV_BAR)
} }
} }
@@ -69,21 +76,29 @@ fun FlickerTestParameter.entireScreenCovered(allStates: Boolean = true) {
} }
} }
/**
* Checks that [FlickerComponentName.NAV_BAR] layer is visible at the start and end of the SF
* trace
*/
fun FlickerTestParameter.navBarLayerIsVisible() { fun FlickerTestParameter.navBarLayerIsVisible() {
assertLayersStart { assertLayersStart {
this.isVisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) this.isVisible(FlickerComponentName.NAV_BAR)
} }
assertLayersEnd { assertLayersEnd {
this.isVisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) this.isVisible(FlickerComponentName.NAV_BAR)
} }
} }
/**
* Checks that [FlickerComponentName.STATUS_BAR] layer is visible at the start and end of the SF
* trace
*/
fun FlickerTestParameter.statusBarLayerIsVisible() { fun FlickerTestParameter.statusBarLayerIsVisible() {
assertLayersStart { assertLayersStart {
this.isVisible(WindowManagerStateHelper.STATUS_BAR_COMPONENT) this.isVisible(FlickerComponentName.STATUS_BAR)
} }
assertLayersEnd { assertLayersEnd {
this.isVisible(WindowManagerStateHelper.STATUS_BAR_COMPONENT) this.isVisible(FlickerComponentName.STATUS_BAR)
} }
} }
@@ -96,10 +111,10 @@ fun FlickerTestParameter.navBarLayerRotatesAndScales(
val endingPos = WindowUtils.getNavigationBarPosition(endRotation) val endingPos = WindowUtils.getNavigationBarPosition(endRotation)
assertLayersStart { assertLayersStart {
this.visibleRegion(WindowManagerStateHelper.NAV_BAR_COMPONENT).coversExactly(startingPos) this.visibleRegion(FlickerComponentName.NAV_BAR).coversExactly(startingPos)
} }
assertLayersEnd { assertLayersEnd {
this.visibleRegion(WindowManagerStateHelper.NAV_BAR_COMPONENT).coversExactly(endingPos) this.visibleRegion(FlickerComponentName.NAV_BAR).coversExactly(endingPos)
} }
} }
@@ -112,10 +127,10 @@ fun FlickerTestParameter.statusBarLayerRotatesScales(
val endingPos = WindowUtils.getStatusBarPosition(endRotation) val endingPos = WindowUtils.getStatusBarPosition(endRotation)
assertLayersStart { assertLayersStart {
this.visibleRegion(WindowManagerStateHelper.STATUS_BAR_COMPONENT).coversExactly(startingPos) this.visibleRegion(FlickerComponentName.STATUS_BAR).coversExactly(startingPos)
} }
assertLayersEnd { assertLayersEnd {
this.visibleRegion(WindowManagerStateHelper.STATUS_BAR_COMPONENT).coversExactly(endingPos) this.visibleRegion(FlickerComponentName.STATUS_BAR).coversExactly(endingPos)
} }
} }
@@ -132,15 +147,15 @@ fun FlickerTestParameter.statusBarLayerRotatesScales(
* (useful mostly for app launch) * (useful mostly for app launch)
*/ */
fun FlickerTestParameter.replacesLayer( fun FlickerTestParameter.replacesLayer(
originalLayer: ComponentName, originalLayer: FlickerComponentName,
newLayer: ComponentName, newLayer: FlickerComponentName,
ignoreSnapshot: Boolean = false ignoreSnapshot: Boolean = false
) { ) {
assertLayers { assertLayers {
val assertion = this.isVisible(originalLayer) val assertion = this.isVisible(originalLayer)
if (ignoreSnapshot) { if (ignoreSnapshot) {
assertion.then() assertion.then()
.isVisible(WindowManagerStateHelper.SNAPSHOT_COMPONENT, isOptional = true) .isVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
} }
assertion.then().isVisible(newLayer) assertion.then().isVisible(newLayer)
} }

View File

@@ -23,7 +23,7 @@ import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group1 import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.Test import org.junit.Test
@@ -33,13 +33,38 @@ import org.junit.runners.Parameterized
/** /**
* Test app closes by pressing back button * Test app closes by pressing back button
*
* To run this test: `atest FlickerTests:CloseAppBackButtonTest` * To run this test: `atest FlickerTests:CloseAppBackButtonTest`
*
* Actions:
* Make sure no apps are running on the device
* Launch an app [testApp] and wait animation to complete
* Press back button
*
* To run only the presubmit assertions add: `--
* --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest
* --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Presubmit`
*
* To run only the postsubmit assertions add: `--
* --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest
* --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Postsubmit`
*
* To run only the flaky assertions add: `--
* --module-arg FlickerTests:include-annotation:androidx.test.filters.FlakyTest`
*
* Notes:
* 1. Some default assertions (e.g., nav bar, status bar and screen covered)
* are inherited [CloseAppTransition]
* 2. Part of the test setup occurs automatically via
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
* including configuring navigation mode, initial orientation and ensuring no
* apps are running before setup
*/ */
@RequiresDevice @RequiresDevice
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group1 @Group4
class CloseAppBackButtonTest(testSpec: FlickerTestParameter) : CloseAppTransition(testSpec) { class CloseAppBackButtonTest(testSpec: FlickerTestParameter) : CloseAppTransition(testSpec) {
override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit
get() = { get() = {
@@ -50,14 +75,23 @@ class CloseAppBackButtonTest(testSpec: FlickerTestParameter) : CloseAppTransitio
} }
} }
/** {@inheritDoc} */
@FlakyTest @FlakyTest
@Test @Test
override fun navBarLayerRotatesAndScales() = super.navBarLayerRotatesAndScales() override fun navBarLayerRotatesAndScales() = super.navBarLayerRotatesAndScales()
/** {@inheritDoc} */
@Postsubmit @Postsubmit
@Test
override fun navBarLayerIsVisible() = super.navBarLayerIsVisible() override fun navBarLayerIsVisible() = super.navBarLayerIsVisible()
companion object { companion object {
/**
* Creates the test configurations.
*
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
* repetitions, screen orientation and navigation modes.
*/
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
@JvmStatic @JvmStatic
fun getParams(): List<FlickerTestParameter> { fun getParams(): List<FlickerTestParameter> {

View File

@@ -22,7 +22,7 @@ import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group1 import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.Test import org.junit.Test
@@ -31,14 +31,39 @@ import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized import org.junit.runners.Parameterized
/** /**
* Test app closes by pressing home button. * Test app closes by pressing home button
*
* To run this test: `atest FlickerTests:CloseAppHomeButtonTest` * To run this test: `atest FlickerTests:CloseAppHomeButtonTest`
*
* Actions:
* Make sure no apps are running on the device
* Launch an app [testApp] and wait animation to complete
* Press home button
*
* To run only the presubmit assertions add: `--
* --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest
* --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Presubmit`
*
* To run only the postsubmit assertions add: `--
* --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest
* --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Postsubmit`
*
* To run only the flaky assertions add: `--
* --module-arg FlickerTests:include-annotation:androidx.test.filters.FlakyTest`
*
* Notes:
* 1. Some default assertions (e.g., nav bar, status bar and screen covered)
* are inherited [CloseAppTransition]
* 2. Part of the test setup occurs automatically via
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
* including configuring navigation mode, initial orientation and ensuring no
* apps are running before setup
*/ */
@RequiresDevice @RequiresDevice
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group1 @Group4
class CloseAppHomeButtonTest(testSpec: FlickerTestParameter) : CloseAppTransition(testSpec) { class CloseAppHomeButtonTest(testSpec: FlickerTestParameter) : CloseAppTransition(testSpec) {
override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit
get() = { get() = {
@@ -49,14 +74,23 @@ class CloseAppHomeButtonTest(testSpec: FlickerTestParameter) : CloseAppTransitio
} }
} }
/** {@inheritDoc} */
@FlakyTest @FlakyTest
@Test @Test
override fun navBarLayerRotatesAndScales() = super.navBarLayerRotatesAndScales() override fun navBarLayerRotatesAndScales() = super.navBarLayerRotatesAndScales()
/** {@inheritDoc} */
@Postsubmit @Postsubmit
@Test
override fun navBarLayerIsVisible() = super.navBarLayerIsVisible() override fun navBarLayerIsVisible() = super.navBarLayerIsVisible()
companion object { companion object {
/**
* Creates the test configurations.
*
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
* repetitions, screen orientation and navigation modes.
*/
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
@JvmStatic @JvmStatic
fun getParams(): Collection<FlickerTestParameter> { fun getParams(): Collection<FlickerTestParameter> {

View File

@@ -62,6 +62,10 @@ abstract class CloseAppTransition(protected val testSpec: FlickerTestParameter)
} }
} }
/**
* Entry point for the test runner. It will use this method to initialize and cache
* flicker executions
*/
@FlickerBuilderProvider @FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder { fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply { return FlickerBuilder(instrumentation).apply {
@@ -69,42 +73,64 @@ abstract class CloseAppTransition(protected val testSpec: FlickerTestParameter)
} }
} }
/**
* Checks that the navigation bar window is visible during the whole transition
*/
@Presubmit @Presubmit
@Test @Test
open fun navBarWindowIsVisible() { open fun navBarWindowIsVisible() {
testSpec.navBarWindowIsVisible() testSpec.navBarWindowIsVisible()
} }
/**
* Checks that the status bar window is visible during the whole transition
*/
@Presubmit @Presubmit
@Test @Test
open fun statusBarWindowIsVisible() { open fun statusBarWindowIsVisible() {
testSpec.statusBarWindowIsVisible() testSpec.statusBarWindowIsVisible()
} }
/**
* Checks that the navigation bar layer is visible during the whole transition
*/
@Presubmit @Presubmit
@Test @Test
open fun navBarLayerIsVisible() { open fun navBarLayerIsVisible() {
testSpec.navBarLayerIsVisible() testSpec.navBarLayerIsVisible()
} }
/**
* Checks that the status bar layer is visible during the whole transition
*/
@Presubmit @Presubmit
@Test @Test
open fun statusBarLayerIsVisible() { open fun statusBarLayerIsVisible() {
testSpec.statusBarLayerIsVisible() testSpec.statusBarLayerIsVisible()
} }
/**
* Checks the position of the navigation bar at the start and end of the transition
*/
@Presubmit @Presubmit
@Test @Test
open fun navBarLayerRotatesAndScales() { open fun navBarLayerRotatesAndScales() {
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0) testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0)
} }
/**
* Checks the position of the status bar at the start and end of the transition
*/
@Presubmit @Presubmit
@Test @Test
open fun statusBarLayerRotatesScales() { open fun statusBarLayerRotatesScales() {
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0) testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0)
} }
/**
* Checks that all windows that are visible on the trace, are visible for at least 2
* consecutive entries.
*/
@Presubmit @Presubmit
@Test @Test
open fun visibleWindowsShownMoreThanOneConsecutiveEntry() { open fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
@@ -113,6 +139,10 @@ abstract class CloseAppTransition(protected val testSpec: FlickerTestParameter)
} }
} }
/**
* Checks that all layers that are visible on the trace, are visible for at least 2
* consecutive entries.
*/
@Presubmit @Presubmit
@Test @Test
open fun visibleLayersShownMoreThanOneConsecutiveEntry() { open fun visibleLayersShownMoreThanOneConsecutiveEntry() {
@@ -121,10 +151,17 @@ abstract class CloseAppTransition(protected val testSpec: FlickerTestParameter)
} }
} }
/**
* Checks that all parts of the screen are covered during the transition
*/
@Presubmit @Presubmit
@Test @Test
open fun entireScreenCovered() = testSpec.entireScreenCovered() open fun entireScreenCovered() = testSpec.entireScreenCovered()
/**
* Checks that [testApp] is the top visible app window at the start of the transition and
* that it is replaced by [LAUNCHER_COMPONENT] during the transition
*/
@Presubmit @Presubmit
@Test @Test
open fun launcherReplacesAppWindowAsTopWindow() { open fun launcherReplacesAppWindowAsTopWindow() {
@@ -135,16 +172,23 @@ abstract class CloseAppTransition(protected val testSpec: FlickerTestParameter)
} }
} }
/**
* Checks that [LAUNCHER_COMPONENT] is invisible at the start of the transition and that
* it becomes visible during the transition
*/
@Presubmit @Presubmit
@Test @Test
open fun launcherWindowBecomesVisible() { open fun launcherWindowBecomesVisible() {
testSpec.assertWm { testSpec.assertWm {
this.isAppWindowInvisible(LAUNCHER_COMPONENT) this.isAppWindowNotOnTop(LAUNCHER_COMPONENT)
.then() .then()
.isAppWindowOnTop(LAUNCHER_COMPONENT) .isAppWindowOnTop(LAUNCHER_COMPONENT)
} }
} }
/**
* Checks that [LAUNCHER_COMPONENT] layer becomes visible when [testApp] becomes invisible
*/
@Presubmit @Presubmit
@Test @Test
open fun launcherLayerReplacesApp() { open fun launcherLayerReplacesApp() {

View File

@@ -14,6 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
@file:JvmName("FlickerExtensions")
package com.android.server.wm.flicker.helpers package com.android.server.wm.flicker.helpers
import com.android.server.wm.flicker.Flicker import com.android.server.wm.flicker.Flicker

View File

@@ -17,9 +17,10 @@
package com.android.server.wm.flicker.helpers package com.android.server.wm.flicker.helpers
import android.app.Instrumentation import android.app.Instrumentation
import android.content.ComponentName
import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.UiDevice
import com.android.server.wm.flicker.testapp.ActivityOptions import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
class ImeAppAutoFocusHelper @JvmOverloads constructor( class ImeAppAutoFocusHelper @JvmOverloads constructor(
@@ -27,7 +28,8 @@ class ImeAppAutoFocusHelper @JvmOverloads constructor(
private val rotation: Int, private val rotation: Int,
private val imePackageName: String = IME_PACKAGE, private val imePackageName: String = IME_PACKAGE,
launcherName: String = ActivityOptions.IME_ACTIVITY_AUTO_FOCUS_LAUNCHER_NAME, launcherName: String = ActivityOptions.IME_ACTIVITY_AUTO_FOCUS_LAUNCHER_NAME,
component: ComponentName = ActivityOptions.IME_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME component: FlickerComponentName =
ActivityOptions.IME_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME.toFlickerComponent()
) : ImeAppHelper(instr, launcherName, component) { ) : ImeAppHelper(instr, launcherName, component) {
override fun openIME( override fun openIME(
device: UiDevice, device: UiDevice,

View File

@@ -17,19 +17,21 @@
package com.android.server.wm.flicker.helpers package com.android.server.wm.flicker.helpers
import android.app.Instrumentation import android.app.Instrumentation
import android.content.ComponentName
import android.support.test.launcherhelper.ILauncherStrategy import android.support.test.launcherhelper.ILauncherStrategy
import android.support.test.launcherhelper.LauncherStrategyFactory import android.support.test.launcherhelper.LauncherStrategyFactory
import androidx.test.uiautomator.By import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.Until import androidx.test.uiautomator.Until
import com.android.server.wm.flicker.testapp.ActivityOptions import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
open class ImeAppHelper @JvmOverloads constructor( open class ImeAppHelper @JvmOverloads constructor(
instr: Instrumentation, instr: Instrumentation,
launcherName: String = ActivityOptions.IME_ACTIVITY_LAUNCHER_NAME, launcherName: String = ActivityOptions.IME_ACTIVITY_LAUNCHER_NAME,
component: ComponentName = ActivityOptions.IME_ACTIVITY_COMPONENT_NAME, component: FlickerComponentName =
ActivityOptions.IME_ACTIVITY_COMPONENT_NAME.toFlickerComponent(),
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
.getInstance(instr) .getInstance(instr)
.launcherStrategy .launcherStrategy

View File

@@ -17,15 +17,17 @@
package com.android.server.wm.flicker.helpers package com.android.server.wm.flicker.helpers
import android.app.Instrumentation import android.app.Instrumentation
import android.content.ComponentName
import android.support.test.launcherhelper.ILauncherStrategy import android.support.test.launcherhelper.ILauncherStrategy
import android.support.test.launcherhelper.LauncherStrategyFactory import android.support.test.launcherhelper.LauncherStrategyFactory
import com.android.server.wm.flicker.testapp.ActivityOptions import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.parser.toFlickerComponent
class NonResizeableAppHelper @JvmOverloads constructor( class NonResizeableAppHelper @JvmOverloads constructor(
instr: Instrumentation, instr: Instrumentation,
launcherName: String = ActivityOptions.NON_RESIZEABLE_ACTIVITY_LAUNCHER_NAME, launcherName: String = ActivityOptions.NON_RESIZEABLE_ACTIVITY_LAUNCHER_NAME,
component: ComponentName = ActivityOptions.NON_RESIZEABLE_ACTIVITY_COMPONENT_NAME, component: FlickerComponentName =
ActivityOptions.NON_RESIZEABLE_ACTIVITY_COMPONENT_NAME.toFlickerComponent(),
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
.getInstance(instr) .getInstance(instr)
.launcherStrategy .launcherStrategy

View File

@@ -17,15 +17,17 @@
package com.android.server.wm.flicker.helpers package com.android.server.wm.flicker.helpers
import android.app.Instrumentation import android.app.Instrumentation
import android.content.ComponentName
import android.support.test.launcherhelper.ILauncherStrategy import android.support.test.launcherhelper.ILauncherStrategy
import android.support.test.launcherhelper.LauncherStrategyFactory import android.support.test.launcherhelper.LauncherStrategyFactory
import com.android.server.wm.flicker.testapp.ActivityOptions import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.parser.toFlickerComponent
class SeamlessRotationAppHelper @JvmOverloads constructor( class SeamlessRotationAppHelper @JvmOverloads constructor(
instr: Instrumentation, instr: Instrumentation,
launcherName: String = ActivityOptions.SEAMLESS_ACTIVITY_LAUNCHER_NAME, launcherName: String = ActivityOptions.SEAMLESS_ACTIVITY_LAUNCHER_NAME,
component: ComponentName = ActivityOptions.SEAMLESS_ACTIVITY_COMPONENT_NAME, component: FlickerComponentName =
ActivityOptions.SEAMLESS_ACTIVITY_COMPONENT_NAME.toFlickerComponent(),
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
.getInstance(instr) .getInstance(instr)
.launcherStrategy .launcherStrategy

View File

@@ -17,15 +17,17 @@
package com.android.server.wm.flicker.helpers package com.android.server.wm.flicker.helpers
import android.app.Instrumentation import android.app.Instrumentation
import android.content.ComponentName
import android.support.test.launcherhelper.ILauncherStrategy import android.support.test.launcherhelper.ILauncherStrategy
import android.support.test.launcherhelper.LauncherStrategyFactory import android.support.test.launcherhelper.LauncherStrategyFactory
import com.android.server.wm.flicker.testapp.ActivityOptions import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.parser.toFlickerComponent
class SimpleAppHelper @JvmOverloads constructor( class SimpleAppHelper @JvmOverloads constructor(
instr: Instrumentation, instr: Instrumentation,
launcherName: String = ActivityOptions.SIMPLE_ACTIVITY_LAUNCHER_NAME, launcherName: String = ActivityOptions.SIMPLE_ACTIVITY_LAUNCHER_NAME,
component: ComponentName = ActivityOptions.SIMPLE_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME, component: FlickerComponentName =
ActivityOptions.SIMPLE_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME.toFlickerComponent(),
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
.getInstance(instr) .getInstance(instr)
.launcherStrategy .launcherStrategy

View File

@@ -17,19 +17,21 @@
package com.android.server.wm.flicker.helpers package com.android.server.wm.flicker.helpers
import android.app.Instrumentation import android.app.Instrumentation
import android.content.ComponentName
import android.support.test.launcherhelper.ILauncherStrategy import android.support.test.launcherhelper.ILauncherStrategy
import android.support.test.launcherhelper.LauncherStrategyFactory import android.support.test.launcherhelper.LauncherStrategyFactory
import androidx.test.uiautomator.By import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.Until import androidx.test.uiautomator.Until
import com.android.server.wm.flicker.testapp.ActivityOptions import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
class TwoActivitiesAppHelper @JvmOverloads constructor( class TwoActivitiesAppHelper @JvmOverloads constructor(
instr: Instrumentation, instr: Instrumentation,
launcherName: String = ActivityOptions.BUTTON_ACTIVITY_LAUNCHER_NAME, launcherName: String = ActivityOptions.BUTTON_ACTIVITY_LAUNCHER_NAME,
component: ComponentName = ActivityOptions.BUTTON_ACTIVITY_COMPONENT_NAME, component: FlickerComponentName =
ActivityOptions.BUTTON_ACTIVITY_COMPONENT_NAME.toFlickerComponent(),
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
.getInstance(instr) .getInstance(instr)
.launcherStrategy .launcherStrategy

View File

@@ -37,7 +37,7 @@ import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@@ -125,7 +125,7 @@ class CloseImeAutoOpenWindowToAppTest(private val testSpec: FlickerTestParameter
@Test @Test
fun imeLayerVisibleStart() { fun imeLayerVisibleStart() {
testSpec.assertLayersStart { testSpec.assertLayersStart {
this.isVisible(WindowManagerStateHelper.IME_COMPONENT) this.isVisible(FlickerComponentName.IME)
} }
} }
@@ -133,7 +133,7 @@ class CloseImeAutoOpenWindowToAppTest(private val testSpec: FlickerTestParameter
@Test @Test
fun imeLayerInvisibleEnd() { fun imeLayerInvisibleEnd() {
testSpec.assertLayersEnd { testSpec.assertLayersEnd {
this.isInvisible(WindowManagerStateHelper.IME_COMPONENT) this.isInvisible(FlickerComponentName.IME)
} }
} }

View File

@@ -38,7 +38,7 @@ import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@@ -110,7 +110,7 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete
testSpec.assertWm { testSpec.assertWm {
this.isAppWindowOnTop(testApp.component) this.isAppWindowOnTop(testApp.component)
.then() .then()
.appWindowNotOnTop(testApp.component) .isAppWindowNotOnTop(testApp.component)
} }
} }
@@ -122,7 +122,7 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete
@Test @Test
fun imeLayerVisibleStart() { fun imeLayerVisibleStart() {
testSpec.assertLayersStart { testSpec.assertLayersStart {
this.isVisible(WindowManagerStateHelper.IME_COMPONENT) this.isVisible(FlickerComponentName.IME)
} }
} }
@@ -130,7 +130,7 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete
@Test @Test
fun imeLayerInvisibleEnd() { fun imeLayerInvisibleEnd() {
testSpec.assertLayersEnd { testSpec.assertLayersEnd {
this.isInvisible(WindowManagerStateHelper.IME_COMPONENT) this.isInvisible(FlickerComponentName.IME)
} }
} }
@@ -173,8 +173,8 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete
fun visibleLayersShownMoreThanOneConsecutiveEntry() { fun visibleLayersShownMoreThanOneConsecutiveEntry() {
testSpec.assertLayers { testSpec.assertLayers {
this.visibleLayersShownMoreThanOneConsecutiveEntry(listOf( this.visibleLayersShownMoreThanOneConsecutiveEntry(listOf(
WindowManagerStateHelper.IME_COMPONENT, FlickerComponentName.IME,
WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT)) FlickerComponentName.SPLASH_SCREEN))
} }
} }

View File

@@ -35,8 +35,8 @@ import com.android.server.wm.flicker.entireScreenCovered
import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.FlickerComponentName
import org.junit.Assume import org.junit.Assume
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@@ -91,9 +91,9 @@ class CloseImeWindowToAppTest(private val testSpec: FlickerTestParameter) {
fun visibleWindowsShownMoreThanOneConsecutiveEntry() { fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
testSpec.assertWm { testSpec.assertWm {
this.visibleWindowsShownMoreThanOneConsecutiveEntry(listOf( this.visibleWindowsShownMoreThanOneConsecutiveEntry(listOf(
WindowManagerStateHelper.IME_COMPONENT, FlickerComponentName.IME,
WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, FlickerComponentName.SPLASH_SCREEN,
WindowManagerStateHelper.SNAPSHOT_COMPONENT)) FlickerComponentName.SNAPSHOT))
} }
} }

View File

@@ -37,7 +37,7 @@ import com.android.server.wm.flicker.entireScreenCovered
import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@@ -95,9 +95,9 @@ class CloseImeWindowToHomeTest(private val testSpec: FlickerTestParameter) {
fun visibleWindowsShownMoreThanOneConsecutiveEntry() { fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
testSpec.assertWm { testSpec.assertWm {
this.visibleWindowsShownMoreThanOneConsecutiveEntry(listOf( this.visibleWindowsShownMoreThanOneConsecutiveEntry(listOf(
WindowManagerStateHelper.IME_COMPONENT, FlickerComponentName.IME,
WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, FlickerComponentName.SPLASH_SCREEN,
WindowManagerStateHelper.SNAPSHOT_COMPONENT)) FlickerComponentName.SNAPSHOT))
} }
} }
@@ -157,8 +157,8 @@ class CloseImeWindowToHomeTest(private val testSpec: FlickerTestParameter) {
fun visibleLayersShownMoreThanOneConsecutiveEntry() { fun visibleLayersShownMoreThanOneConsecutiveEntry() {
testSpec.assertLayers { testSpec.assertLayers {
this.visibleLayersShownMoreThanOneConsecutiveEntry(listOf( this.visibleLayersShownMoreThanOneConsecutiveEntry(listOf(
WindowManagerStateHelper.IME_COMPONENT, FlickerComponentName.IME,
WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT)) FlickerComponentName.SPLASH_SCREEN))
} }
} }

View File

@@ -18,52 +18,52 @@
package com.android.server.wm.flicker.ime package com.android.server.wm.flicker.ime
import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
fun FlickerTestParameter.imeLayerBecomesVisible() { fun FlickerTestParameter.imeLayerBecomesVisible() {
assertLayers { assertLayers {
this.isInvisible(WindowManagerStateHelper.IME_COMPONENT) this.isInvisible(FlickerComponentName.IME)
.then() .then()
.isVisible(WindowManagerStateHelper.IME_COMPONENT) .isVisible(FlickerComponentName.IME)
} }
} }
fun FlickerTestParameter.imeLayerBecomesInvisible() { fun FlickerTestParameter.imeLayerBecomesInvisible() {
assertLayers { assertLayers {
this.isVisible(WindowManagerStateHelper.IME_COMPONENT) this.isVisible(FlickerComponentName.IME)
.then() .then()
.isInvisible(WindowManagerStateHelper.IME_COMPONENT) .isInvisible(FlickerComponentName.IME)
} }
} }
fun FlickerTestParameter.imeWindowIsAlwaysVisible(rotatesScreen: Boolean = false) { fun FlickerTestParameter.imeWindowIsAlwaysVisible(rotatesScreen: Boolean = false) {
if (rotatesScreen) { if (rotatesScreen) {
assertWm { assertWm {
this.isNonAppWindowVisible(WindowManagerStateHelper.IME_COMPONENT) this.isNonAppWindowVisible(FlickerComponentName.IME)
.then() .then()
.isNonAppWindowInvisible(WindowManagerStateHelper.IME_COMPONENT) .isNonAppWindowInvisible(FlickerComponentName.IME)
.then() .then()
.isNonAppWindowVisible(WindowManagerStateHelper.IME_COMPONENT) .isNonAppWindowVisible(FlickerComponentName.IME)
} }
} else { } else {
assertWm { assertWm {
this.isNonAppWindowVisible(WindowManagerStateHelper.IME_COMPONENT) this.isNonAppWindowVisible(FlickerComponentName.IME)
} }
} }
} }
fun FlickerTestParameter.imeWindowBecomesVisible() { fun FlickerTestParameter.imeWindowBecomesVisible() {
assertWm { assertWm {
this.isNonAppWindowInvisible(WindowManagerStateHelper.IME_COMPONENT) this.isNonAppWindowInvisible(FlickerComponentName.IME)
.then() .then()
.isNonAppWindowVisible(WindowManagerStateHelper.IME_COMPONENT) .isNonAppWindowVisible(FlickerComponentName.IME)
} }
} }
fun FlickerTestParameter.imeWindowBecomesInvisible() { fun FlickerTestParameter.imeWindowBecomesInvisible() {
assertWm { assertWm {
this.isNonAppWindowVisible(WindowManagerStateHelper.IME_COMPONENT) this.isNonAppWindowVisible(FlickerComponentName.IME)
.then() .then()
.isNonAppWindowInvisible(WindowManagerStateHelper.IME_COMPONENT) .isNonAppWindowInvisible(FlickerComponentName.IME)
} }
} }

View File

@@ -20,6 +20,7 @@ import android.app.Instrumentation
import android.platform.test.annotations.Presubmit import android.platform.test.annotations.Presubmit
import android.view.Surface import android.view.Surface
import android.view.WindowManagerPolicyConstants import android.view.WindowManagerPolicyConstants
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider import com.android.server.wm.flicker.FlickerBuilderProvider
@@ -142,7 +143,7 @@ class OpenImeWindowTest(private val testSpec: FlickerTestParameter) {
} }
} }
@Presubmit @FlakyTest
@Test @Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() { fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
testSpec.assertWm { testSpec.assertWm {

View File

@@ -17,7 +17,6 @@
package com.android.server.wm.flicker.ime package com.android.server.wm.flicker.ime
import android.app.Instrumentation import android.app.Instrumentation
import android.content.ComponentName
import android.os.SystemProperties import android.os.SystemProperties
import android.platform.test.annotations.Presubmit import android.platform.test.annotations.Presubmit
import android.view.Surface import android.view.Surface
@@ -43,7 +42,7 @@ import com.android.server.wm.flicker.endRotation
import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import org.junit.Assume import org.junit.Assume
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.Test import org.junit.Test
@@ -104,12 +103,12 @@ class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
@Presubmit @Presubmit
@Test @Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() { fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
val component = ComponentName("", "RecentTaskScreenshotSurface") val component = FlickerComponentName("", "RecentTaskScreenshotSurface")
testSpec.assertWm { testSpec.assertWm {
this.visibleWindowsShownMoreThanOneConsecutiveEntry( this.visibleWindowsShownMoreThanOneConsecutiveEntry(
ignoreWindows = listOf(WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, ignoreWindows = listOf(FlickerComponentName.SPLASH_SCREEN,
WindowManagerStateHelper.SNAPSHOT_COMPONENT, FlickerComponentName.SNAPSHOT,
component) component)
) )
} }
} }
@@ -138,9 +137,9 @@ class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
// Since we log 1x per frame, sometimes the activity visibility and the app visibility // Since we log 1x per frame, sometimes the activity visibility and the app visibility
// are updated together, sometimes not, thus ignore activity check at the start // are updated together, sometimes not, thus ignore activity check at the start
testSpec.assertWm { testSpec.assertWm {
this.isAppWindowVisible(testApp.component, ignoreActivity = true) this.isAppWindowVisible(testApp.component)
.then() .then()
.isAppWindowInvisible(testApp.component, ignoreActivity = true) .isAppWindowInvisible(testApp.component)
.then() .then()
.isAppWindowVisible(testApp.component) .isAppWindowVisible(testApp.component)
} }
@@ -155,7 +154,7 @@ class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
// and the app visibility are updated together, sometimes not, thus ignore activity // and the app visibility are updated together, sometimes not, thus ignore activity
// check at the start // check at the start
testSpec.assertWm { testSpec.assertWm {
this.isAppWindowVisible(testApp.component, ignoreActivity = true) this.isAppWindowVisible(testApp.component)
} }
} }
@@ -177,11 +176,11 @@ class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
fun imeLayerIsBecomesVisibleLegacy() { fun imeLayerIsBecomesVisibleLegacy() {
Assume.assumeFalse(isShellTransitionsEnabled) Assume.assumeFalse(isShellTransitionsEnabled)
testSpec.assertLayers { testSpec.assertLayers {
this.isVisible(WindowManagerStateHelper.IME_COMPONENT) this.isVisible(FlickerComponentName.IME)
.then() .then()
.isInvisible(WindowManagerStateHelper.IME_COMPONENT) .isInvisible(FlickerComponentName.IME)
.then() .then()
.isVisible(WindowManagerStateHelper.IME_COMPONENT) .isVisible(FlickerComponentName.IME)
} }
} }
@@ -190,7 +189,7 @@ class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
fun imeLayerIsBecomesVisible() { fun imeLayerIsBecomesVisible() {
Assume.assumeTrue(isShellTransitionsEnabled) Assume.assumeTrue(isShellTransitionsEnabled)
testSpec.assertLayers { testSpec.assertLayers {
this.isVisible(WindowManagerStateHelper.IME_COMPONENT) this.isVisible(FlickerComponentName.IME)
} }
} }
@@ -200,7 +199,7 @@ class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
testSpec.assertLayers { testSpec.assertLayers {
this.isVisible(LAUNCHER_COMPONENT) this.isVisible(LAUNCHER_COMPONENT)
.then() .then()
.isVisible(WindowManagerStateHelper.SNAPSHOT_COMPONENT, isOptional = true) .isVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.then() .then()
.isVisible(testApp.component) .isVisible(testApp.component)
} }
@@ -223,11 +222,11 @@ class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
fun visibleLayersShownMoreThanOneConsecutiveEntry() { fun visibleLayersShownMoreThanOneConsecutiveEntry() {
// depends on how much of the animation transactions are sent to SF at once // depends on how much of the animation transactions are sent to SF at once
// sometimes this layer appears for 2-3 frames, sometimes for only 1 // sometimes this layer appears for 2-3 frames, sometimes for only 1
val recentTaskComponent = ComponentName("", "RecentTaskScreenshotSurface") val recentTaskComponent = FlickerComponentName("", "RecentTaskScreenshotSurface")
testSpec.assertLayers { testSpec.assertLayers {
this.visibleLayersShownMoreThanOneConsecutiveEntry( this.visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, listOf(FlickerComponentName.SPLASH_SCREEN,
WindowManagerStateHelper.SNAPSHOT_COMPONENT, recentTaskComponent) FlickerComponentName.SNAPSHOT, recentTaskComponent)
) )
} }
} }

View File

@@ -17,7 +17,6 @@
package com.android.server.wm.flicker.ime package com.android.server.wm.flicker.ime
import android.app.Instrumentation import android.app.Instrumentation
import android.content.ComponentName
import android.platform.test.annotations.Presubmit import android.platform.test.annotations.Presubmit
import android.view.Surface import android.view.Surface
import android.view.WindowManagerPolicyConstants import android.view.WindowManagerPolicyConstants
@@ -28,7 +27,7 @@ import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group2 import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper
import com.android.server.wm.flicker.helpers.SimpleAppHelper import com.android.server.wm.flicker.helpers.SimpleAppHelper
import com.android.server.wm.flicker.helpers.WindowUtils import com.android.server.wm.flicker.helpers.WindowUtils
@@ -36,7 +35,7 @@ import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.navBarWindowIsVisible import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.Test import org.junit.Test
@@ -52,7 +51,7 @@ import org.junit.runners.Parameterized
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group2 @Group4
@Presubmit @Presubmit
class SwitchImeWindowsFromGestureNavTest(private val testSpec: FlickerTestParameter) { class SwitchImeWindowsFromGestureNavTest(private val testSpec: FlickerTestParameter) {
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
@@ -107,51 +106,52 @@ class SwitchImeWindowsFromGestureNavTest(private val testSpec: FlickerTestParame
@Test @Test
fun imeAppWindowVisibility() { fun imeAppWindowVisibility() {
val component = ComponentName(imeTestApp.`package`, "")
testSpec.assertWm { testSpec.assertWm {
this.isAppWindowOnTop(component) isAppWindowVisible(imeTestApp.component)
.then() .then()
.isAppWindowVisible(component, ignoreActivity = true) .isAppWindowVisible(testApp.component)
.then()
.isAppWindowVisible(imeTestApp.component)
} }
} }
@Test @Test
fun navBarLayerIsVisibleAroundSwitching() { fun navBarLayerIsVisibleAroundSwitching() {
testSpec.assertLayersStart { testSpec.assertLayersStart {
isVisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) isVisible(FlickerComponentName.NAV_BAR)
} }
testSpec.assertLayersEnd { testSpec.assertLayersEnd {
isVisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) isVisible(FlickerComponentName.NAV_BAR)
} }
} }
@Test @Test
fun statusBarLayerIsVisibleAroundSwitching() { fun statusBarLayerIsVisibleAroundSwitching() {
testSpec.assertLayersStart { testSpec.assertLayersStart {
isVisible(WindowManagerStateHelper.STATUS_BAR_COMPONENT) isVisible(FlickerComponentName.STATUS_BAR)
} }
testSpec.assertLayersEnd { testSpec.assertLayersEnd {
isVisible(WindowManagerStateHelper.STATUS_BAR_COMPONENT) isVisible(FlickerComponentName.STATUS_BAR)
} }
} }
@Test @Test
fun imeLayerIsVisibleWhenSwitchingToImeApp() { fun imeLayerIsVisibleWhenSwitchingToImeApp() {
testSpec.assertLayersStart { testSpec.assertLayersStart {
isVisible(WindowManagerStateHelper.IME_COMPONENT) isVisible(FlickerComponentName.IME)
} }
testSpec.assertLayersTag(TAG_IME_VISIBLE) { testSpec.assertLayersTag(TAG_IME_VISIBLE) {
isVisible(WindowManagerStateHelper.IME_COMPONENT) isVisible(FlickerComponentName.IME)
} }
testSpec.assertLayersEnd { testSpec.assertLayersEnd {
isVisible(WindowManagerStateHelper.IME_COMPONENT) isVisible(FlickerComponentName.IME)
} }
} }
@Test @Test
fun imeLayerIsInvisibleWhenSwitchingToTestApp() { fun imeLayerIsInvisibleWhenSwitchingToTestApp() {
testSpec.assertLayersTag(TAG_IME_INVISIBLE) { testSpec.assertLayersTag(TAG_IME_INVISIBLE) {
isInvisible(WindowManagerStateHelper.IME_COMPONENT) isInvisible(FlickerComponentName.IME)
} }
} }

View File

@@ -27,10 +27,11 @@ import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.LAUNCHER_COMPONENT import com.android.server.wm.flicker.LAUNCHER_COMPONENT
import com.android.server.wm.flicker.repetitions import com.android.server.wm.flicker.repetitions
import com.android.server.wm.flicker.annotation.Group1 import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.TwoActivitiesAppHelper import com.android.server.wm.flicker.helpers.TwoActivitiesAppHelper
import com.android.server.wm.flicker.testapp.ActivityOptions import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.parser.toFlickerComponent
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@@ -39,17 +40,33 @@ import org.junit.runners.Parameterized
/** /**
* Test the back and forward transition between 2 activities. * Test the back and forward transition between 2 activities.
*
* To run this test: `atest FlickerTests:ActivitiesTransitionTest` * To run this test: `atest FlickerTests:ActivitiesTransitionTest`
*
* Actions:
* Launch an app
* Launch a secondary activity within the app
* Close the secondary activity back to the initial one
*
* Notes:
* 1. Part of the test setup occurs automatically via
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
* including configuring navigation mode, initial orientation and ensuring no
* apps are running before setup
*/ */
@RequiresDevice @RequiresDevice
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group1 @Group4
class ActivitiesTransitionTest(val testSpec: FlickerTestParameter) { class ActivitiesTransitionTest(val testSpec: FlickerTestParameter) {
val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
private val testApp: TwoActivitiesAppHelper = TwoActivitiesAppHelper(instrumentation) private val testApp: TwoActivitiesAppHelper = TwoActivitiesAppHelper(instrumentation)
/**
* Entry point for the test runner. It will use this method to initialize and cache
* flicker executions
*/
@FlickerBuilderProvider @FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder { fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply { return FlickerBuilder(instrumentation).apply {
@@ -75,30 +92,52 @@ class ActivitiesTransitionTest(val testSpec: FlickerTestParameter) {
} }
} }
/**
* Checks that the [ActivityOptions.BUTTON_ACTIVITY_COMPONENT_NAME] activity is visible at
* the start of the transition, that
* [ActivityOptions.SIMPLE_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME] becomes visible during the
* transition, and that [ActivityOptions.BUTTON_ACTIVITY_COMPONENT_NAME] is again visible
* at the end
*/
@Presubmit @Presubmit
@Test @Test
fun finishSubActivity() { fun finishSubActivity() {
val buttonActivityComponent = ActivityOptions
.BUTTON_ACTIVITY_COMPONENT_NAME.toFlickerComponent()
val imeAutoFocusActivityComponent = ActivityOptions
.SIMPLE_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME.toFlickerComponent()
testSpec.assertWm { testSpec.assertWm {
this.isAppWindowOnTop(ActivityOptions.BUTTON_ACTIVITY_COMPONENT_NAME) this.isAppWindowOnTop(buttonActivityComponent)
.then() .then()
.isAppWindowOnTop(ActivityOptions.SIMPLE_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME) .isAppWindowOnTop(imeAutoFocusActivityComponent)
.then() .then()
.isAppWindowOnTop(ActivityOptions.BUTTON_ACTIVITY_COMPONENT_NAME) .isAppWindowOnTop(buttonActivityComponent)
} }
} }
/**
* Checks that all parts of the screen are covered during the transition
*/
@Presubmit @Presubmit
@Test @Test
fun entireScreenCovered() = testSpec.entireScreenCovered() fun entireScreenCovered() = testSpec.entireScreenCovered()
/**
* Checks that the [LAUNCHER_COMPONENT] window is not on top. The launcher cannot be
* asserted with `isAppWindowVisible` because it contains 2 windows with the exact same name,
* and both are never simultaneously visible
*/
@Presubmit @Presubmit
@Test @Test
fun launcherWindowNotVisible() { fun launcherWindowNotOnTop() {
testSpec.assertWm { testSpec.assertWm {
this.isAppWindowInvisible(LAUNCHER_COMPONENT, ignoreActivity = true) this.isAppWindowNotOnTop(LAUNCHER_COMPONENT)
} }
} }
/**
* Checks that the [LAUNCHER_COMPONENT] layer is never visible during the transition
*/
@Presubmit @Presubmit
@Test @Test
fun launcherLayerNotVisible() { fun launcherLayerNotVisible() {
@@ -106,6 +145,12 @@ class ActivitiesTransitionTest(val testSpec: FlickerTestParameter) {
} }
companion object { companion object {
/**
* Creates the test configurations.
*
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
* repetitions, screen orientation and navigation modes.
*/
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
@JvmStatic @JvmStatic
fun getParams(): Collection<FlickerTestParameter> { fun getParams(): Collection<FlickerTestParameter> {

View File

@@ -16,7 +16,6 @@
package com.android.server.wm.flicker.launch package com.android.server.wm.flicker.launch
import android.content.ComponentName
import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit import android.platform.test.annotations.Presubmit
import android.view.Surface import android.view.Surface
@@ -29,7 +28,7 @@ import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group1 import com.android.server.wm.flicker.annotation.Group1
import com.android.server.wm.flicker.helpers.NonResizeableAppHelper import com.android.server.wm.flicker.helpers.NonResizeableAppHelper
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import com.google.common.truth.Truth import com.google.common.truth.Truth
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.Test import org.junit.Test
@@ -61,7 +60,7 @@ import org.junit.runners.Parameterized
@Group1 @Group1
class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) : OpenAppTransition(testSpec) { class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) : OpenAppTransition(testSpec) {
override val testApp = NonResizeableAppHelper(instrumentation) override val testApp = NonResizeableAppHelper(instrumentation)
private val colorFadComponent = ComponentName("", "ColorFade BLAST#") private val colorFadComponent = FlickerComponentName("", "ColorFade BLAST#")
/** /**
* Defines the transition used to run the test * Defines the transition used to run the test
@@ -92,15 +91,15 @@ class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) : OpenAppTransiti
* Checks that the nav bar layer starts visible, becomes invisible during unlocking animation * Checks that the nav bar layer starts visible, becomes invisible during unlocking animation
* and becomes visible at the end * and becomes visible at the end
*/ */
@Presubmit @Postsubmit
@Test @Test
fun navBarLayerVisibilityChanges() { fun navBarLayerVisibilityChanges() {
testSpec.assertLayers { testSpec.assertLayers {
this.isVisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) this.isVisible(FlickerComponentName.NAV_BAR)
.then() .then()
.isInvisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) .isInvisible(FlickerComponentName.NAV_BAR)
.then() .then()
.isVisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) .isVisible(FlickerComponentName.NAV_BAR)
} }
} }
@@ -133,10 +132,9 @@ class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) : OpenAppTransiti
testSpec.assertWm { testSpec.assertWm {
this.notContains(testApp.component) this.notContains(testApp.component)
.then() .then()
.isAppWindowInvisible(testApp.component, .isAppWindowInvisible(testApp.component, isOptional = true)
ignoreActivity = true, isOptional = true)
.then() .then()
.isAppWindowVisible(testApp.component, ignoreActivity = true) .isAppWindowVisible(testApp.component)
} }
} }
@@ -147,7 +145,7 @@ class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) : OpenAppTransiti
@Test @Test
fun appWindowBecomesVisibleAtEnd() { fun appWindowBecomesVisibleAtEnd() {
testSpec.assertWmEnd { testSpec.assertWmEnd {
this.isVisible(testApp.component) this.isAppWindowVisible(testApp.component)
} }
} }
@@ -159,11 +157,11 @@ class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) : OpenAppTransiti
@Test @Test
fun navBarWindowsVisibilityChanges() { fun navBarWindowsVisibilityChanges() {
testSpec.assertWm { testSpec.assertWm {
this.isAboveAppWindowVisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) this.isAboveAppWindowVisible(FlickerComponentName.NAV_BAR)
.then() .then()
.isNonAppWindowInvisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) .isNonAppWindowInvisible(FlickerComponentName.NAV_BAR)
.then() .then()
.isAboveAppWindowVisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) .isAboveAppWindowVisible(FlickerComponentName.NAV_BAR)
} }
} }
@@ -173,6 +171,10 @@ class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) : OpenAppTransiti
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() = override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
super.visibleWindowsShownMoreThanOneConsecutiveEntry() super.visibleWindowsShownMoreThanOneConsecutiveEntry()
@FlakyTest
@Test
override fun navBarLayerRotatesAndScales() = super.navBarLayerRotatesAndScales()
/** {@inheritDoc} */ /** {@inheritDoc} */
@FlakyTest @FlakyTest
@Test @Test

View File

@@ -39,10 +39,12 @@ import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.SNAPSHOT_COMPONENT import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.SPLASH_SCREEN_COMPONENT
import org.junit.Test import org.junit.Test
/**
* Base class for app launch tests
*/
abstract class OpenAppTransition(protected val testSpec: FlickerTestParameter) { abstract class OpenAppTransition(protected val testSpec: FlickerTestParameter) {
protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
protected open val testApp: StandardAppHelper = SimpleAppHelper(instrumentation) protected open val testApp: StandardAppHelper = SimpleAppHelper(instrumentation)
@@ -85,7 +87,7 @@ abstract class OpenAppTransition(protected val testSpec: FlickerTestParameter) {
} }
/** /**
* Checks that the navigation bar layer is visible during the whole transition * Checks that the navigation bar layer is visible at the start and end of the trace
*/ */
open fun navBarLayerIsVisible() { open fun navBarLayerIsVisible() {
testSpec.navBarLayerIsVisible() testSpec.navBarLayerIsVisible()
@@ -110,7 +112,7 @@ abstract class OpenAppTransition(protected val testSpec: FlickerTestParameter) {
} }
/** /**
* Checks that the status bar layer is visible during the whole transition * Checks that the status bar layer is visible at the start and end of the trace
*/ */
@Presubmit @Presubmit
@Test @Test
@@ -188,9 +190,9 @@ abstract class OpenAppTransition(protected val testSpec: FlickerTestParameter) {
testSpec.assertWm { testSpec.assertWm {
this.isAppWindowOnTop(LAUNCHER_COMPONENT) this.isAppWindowOnTop(LAUNCHER_COMPONENT)
.then() .then()
.isAppWindowOnTop(SNAPSHOT_COMPONENT, isOptional = true) .isAppWindowOnTop(FlickerComponentName.SNAPSHOT, isOptional = true)
.then() .then()
.isAppWindowOnTop(SPLASH_SCREEN_COMPONENT, isOptional = true) .isAppWindowOnTop(FlickerComponentName.SPLASH_SCREEN, isOptional = true)
.then() .then()
.isAppWindowOnTop(testApp.component) .isAppWindowOnTop(testApp.component)
} }
@@ -202,9 +204,9 @@ abstract class OpenAppTransition(protected val testSpec: FlickerTestParameter) {
*/ */
open fun launcherWindowBecomesInvisible() { open fun launcherWindowBecomesInvisible() {
testSpec.assertWm { testSpec.assertWm {
this.isAppWindowVisible(LAUNCHER_COMPONENT) this.isAppWindowOnTop(LAUNCHER_COMPONENT)
.then() .then()
.isAppWindowInvisible(LAUNCHER_COMPONENT) .isAppWindowNotOnTop(LAUNCHER_COMPONENT)
} }
} }
} }

View File

@@ -39,7 +39,7 @@ import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.SNAPSHOT_COMPONENT import com.android.server.wm.traces.common.FlickerComponentName
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@@ -189,9 +189,9 @@ class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestParamet
testSpec.assertWm { testSpec.assertWm {
this.isAppWindowInvisible(testApp1.component) this.isAppWindowInvisible(testApp1.component)
.then() .then()
.isAppWindowVisible(SNAPSHOT_COMPONENT, isOptional = true) .isAppWindowVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.then() .then()
.isAppWindowVisible(testApp1.component, ignoreActivity = true) .isAppWindowVisible(testApp1.component)
} }
} }
@@ -217,7 +217,7 @@ class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestParamet
@Test @Test
fun app2WindowBecomesAndStaysInvisible() { fun app2WindowBecomesAndStaysInvisible() {
testSpec.assertWm { testSpec.assertWm {
this.isAppWindowVisible(testApp2.component, ignoreActivity = true) this.isAppWindowVisible(testApp2.component)
.then() .then()
.isAppWindowInvisible(testApp2.component) .isAppWindowInvisible(testApp2.component)
} }
@@ -251,7 +251,7 @@ class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestParamet
// TODO: Do we actually want to test this? Seems too implementation specific... // TODO: Do we actually want to test this? Seems too implementation specific...
.isAppWindowVisible(LAUNCHER_COMPONENT, isOptional = true) .isAppWindowVisible(LAUNCHER_COMPONENT, isOptional = true)
.then() .then()
.isAppWindowVisible(SNAPSHOT_COMPONENT, isOptional = true) .isAppWindowVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.then() .then()
.isAppWindowVisible(testApp1.component) .isAppWindowVisible(testApp1.component)
} }
@@ -270,7 +270,7 @@ class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestParamet
.then() .then()
.isVisible(LAUNCHER_COMPONENT, isOptional = true) .isVisible(LAUNCHER_COMPONENT, isOptional = true)
.then() .then()
.isVisible(SNAPSHOT_COMPONENT, isOptional = true) .isVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.then() .then()
.isVisible(testApp1.component) .isVisible(testApp1.component)
} }

View File

@@ -0,0 +1,348 @@
/*
* Copyright (C) 2021 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.server.wm.flicker.quickswitch
import android.app.Instrumentation
import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.RequiresDevice
import android.view.Surface
import android.view.WindowManagerPolicyConstants
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.LAUNCHER_COMPONENT
import com.android.server.wm.flicker.annotation.Group1
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.NonResizeableAppHelper
import com.android.server.wm.flicker.helpers.SimpleAppHelper
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.helpers.isRotated
import com.android.server.wm.flicker.navBarLayerIsVisible
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.repetitions
import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.FlickerComponentName
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
/**
* Test quick switching back to previous app from last opened app
*
* To run this test: `atest FlickerTests:QuickSwitchBetweenTwoAppsBackTest`
*
* Actions:
* Launch an app [testApp1]
* Launch another app [testApp2]
* Swipe right from the bottom of the screen to quick switch back to the first app [testApp1]
* Swipe left from the bottom of the screen to quick switch forward to the second app [testApp2]
*/
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group1
class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTestParameter) {
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
private val testApp1 = SimpleAppHelper(instrumentation)
private val testApp2 = NonResizeableAppHelper(instrumentation)
private val startDisplayBounds = WindowUtils.getDisplayBounds(testSpec.config.startRotation)
@FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply {
withTestName { testSpec.name }
repeat { testSpec.config.repetitions }
setup {
eachRun {
testApp1.launchViaIntent(wmHelper)
wmHelper.waitForFullScreenApp(testApp1.component)
testApp2.launchViaIntent(wmHelper)
wmHelper.waitForFullScreenApp(testApp2.component)
// Swipe right from bottom to quick switch back
// NOTE: We don't perform an edge-to-edge swipe but instead only swipe in the middle
// as to not accidentally trigger a swipe back or forward action which would result
// in the same behavior but not testing quick swap.
device.swipe(
startDisplayBounds.bounds.right / 3,
startDisplayBounds.bounds.bottom,
2 * startDisplayBounds.bounds.right / 3,
startDisplayBounds.bounds.bottom,
if (testSpec.config.startRotation.isRotated()) 75 else 30
)
wmHelper.waitForFullScreenApp(testApp1.component)
wmHelper.waitForAppTransitionIdle()
}
}
transitions {
// Swipe left from bottom to quick switch forward
// NOTE: We don't perform an edge-to-edge swipe but instead only swipe in the middle
// as to not accidentally trigger a swipe back or forward action which would result
// in the same behavior but not testing quick swap.
device.swipe(
2 * startDisplayBounds.bounds.right / 3,
startDisplayBounds.bounds.bottom,
startDisplayBounds.bounds.right / 3,
startDisplayBounds.bounds.bottom,
if (testSpec.config.startRotation.isRotated()) 75 else 30
)
wmHelper.waitForFullScreenApp(testApp2.component)
wmHelper.waitForAppTransitionIdle()
}
teardown {
test {
testApp1.exit()
testApp2.exit()
}
}
}
}
/**
* Checks that the transition starts with [testApp1]'s windows filling/covering exactly the
* entirety of the display.
*/
@Postsubmit
@Test
fun startsWithApp1WindowsCoverFullScreen() {
testSpec.assertWmStart {
this.frameRegion(testApp1.component).coversExactly(startDisplayBounds)
}
}
/**
* Checks that the transition starts with [testApp1]'s layers filling/covering exactly the
* entirety of the display.
*/
@Postsubmit
@Test
fun startsWithApp1LayersCoverFullScreen() {
testSpec.assertLayersStart {
this.visibleRegion(testApp1.component).coversExactly(startDisplayBounds)
}
}
/**
* Checks that the transition starts with [testApp1] being the top window.
*/
@Postsubmit
@Test
fun startsWithApp1WindowBeingOnTop() {
testSpec.assertWmStart {
this.isAppWindowOnTop(testApp1.component)
}
}
/**
* Checks that [testApp2] windows fill the entire screen (i.e. is "fullscreen") at the end of the
* transition once we have fully quick switched from [testApp1] back to the [testApp2].
*/
@Postsubmit
@Test
fun endsWithApp2WindowsCoveringFullScreen() {
testSpec.assertWmEnd {
this.frameRegion(testApp2.component).coversExactly(startDisplayBounds)
}
}
/**
* Checks that [testApp2] layers fill the entire screen (i.e. is "fullscreen") at the end of the
* transition once we have fully quick switched from [testApp1] back to the [testApp2].
*/
@Postsubmit
@Test
fun endsWithApp2LayersCoveringFullScreen() {
testSpec.assertLayersEnd {
this.visibleRegion(testApp2.component).coversExactly(startDisplayBounds)
}
}
/**
* Checks that [testApp2] is the top window at the end of the transition once we have fully quick
* switched from [testApp1] back to the [testApp2].
*/
@Postsubmit
@Test
fun endsWithApp2BeingOnTop() {
testSpec.assertWmEnd {
this.isAppWindowOnTop(testApp2.component)
}
}
/**
* Checks that [testApp2]'s window starts off invisible and becomes visible at some point before
* the end of the transition and then stays visible until the end of the transition.
*/
@Postsubmit
@Test
fun app2WindowBecomesAndStaysVisible() {
testSpec.assertWm {
this.isAppWindowInvisible(testApp2.component)
.then()
.isAppWindowVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.then()
.isAppWindowVisible(testApp2.component)
}
}
/**
* Checks that [testApp2]'s layer starts off invisible and becomes visible at some point before
* the end of the transition and then stays visible until the end of the transition.
*/
@Postsubmit
@Test
fun app2LayerBecomesAndStaysVisible() {
testSpec.assertLayers {
this.isInvisible(testApp2.component)
.then()
.isVisible(testApp2.component)
}
}
/**
* Checks that [testApp1]'s window starts off visible and becomes invisible at some point before
* the end of the transition and then stays invisible until the end of the transition.
*/
@Postsubmit
@Test
fun app1WindowBecomesAndStaysInvisible() {
testSpec.assertWm {
this.isAppWindowVisible(testApp1.component)
.then()
.isAppWindowInvisible(testApp1.component)
}
}
/**
* Checks that [testApp1]'s layer starts off visible and becomes invisible at some point before
* the end of the transition and then stays invisible until the end of the transition.
*/
@Postsubmit
@Test
fun app1LayerBecomesAndStaysInvisible() {
testSpec.assertLayers {
this.isVisible(testApp1.component)
.then()
.isInvisible(testApp1.component)
}
}
/**
* Checks that [testApp1]'s window is visible at least until [testApp2]'s window is visible.
* Ensures that at any point, either [testApp2] or [testApp1]'s windows are at least partially
* visible.
*/
@Postsubmit
@Test
fun app2WindowIsVisibleOnceApp1WindowIsInvisible() {
testSpec.assertWm {
this.isAppWindowVisible(testApp1.component)
.then()
.isAppWindowVisible(LAUNCHER_COMPONENT, isOptional = true)
.then()
.isAppWindowVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.then()
.isAppWindowVisible(testApp2.component)
}
}
/**
* Checks that [testApp1]'s layer is visible at least until [testApp2]'s window is visible.
* Ensures that at any point, either [testApp2] or [testApp1]'s windows are at least partially
* visible.
*/
@Postsubmit
@Test
fun app2LayerIsVisibleOnceApp1LayerIsInvisible() {
testSpec.assertLayers {
this.isVisible(testApp1.component)
.then()
.isVisible(LAUNCHER_COMPONENT, isOptional = true)
.then()
.isVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.then()
.isVisible(testApp2.component)
}
}
/**
* Checks that the navbar window is visible throughout the entire transition.
*/
@Postsubmit
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsVisible()
/**
* Checks that the navbar layer is visible throughout the entire transition.
*/
@Postsubmit
@Test
fun navBarLayerAlwaysIsVisible() = testSpec.navBarLayerIsVisible()
/**
* Checks that the navbar is always in the right position and covers the expected region.
*
* NOTE: This doesn't check that the navbar is visible or not.
*/
@Postsubmit
@Test
fun navbarIsAlwaysInRightPosition() =
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation)
/**
* Checks that the status bar window is visible throughout the entire transition.
*/
@Postsubmit
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsVisible()
/**
* Checks that the status bar layer is visible throughout the entire transition.
*/
@Postsubmit
@Test
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsVisible()
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance()
.getConfigNonRotationTests(
repetitions = 5,
supportedNavigationModes = listOf(
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
),
supportedRotations = listOf(Surface.ROTATION_0, Surface.ROTATION_90)
)
}
}
}

View File

@@ -27,7 +27,7 @@ import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.LAUNCHER_COMPONENT import com.android.server.wm.flicker.LAUNCHER_COMPONENT
import com.android.server.wm.flicker.annotation.Group1 import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.entireScreenCovered import com.android.server.wm.flicker.entireScreenCovered
import com.android.server.wm.flicker.helpers.SimpleAppHelper import com.android.server.wm.flicker.helpers.SimpleAppHelper
@@ -38,7 +38,7 @@ import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.SNAPSHOT_COMPONENT import com.android.server.wm.traces.common.FlickerComponentName
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@@ -60,7 +60,7 @@ import org.junit.runners.Parameterized
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Group1 @Group4
class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) { class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
private val testApp = SimpleAppHelper(instrumentation) private val testApp = SimpleAppHelper(instrumentation)
@@ -145,7 +145,7 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
@Test @Test
fun startsWithHomeActivityFlaggedVisible() { fun startsWithHomeActivityFlaggedVisible() {
testSpec.assertWmStart { testSpec.assertWmStart {
this.isHomeActivityVisible(true) this.isHomeActivityVisible()
} }
} }
@@ -192,7 +192,7 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
@Test @Test
fun endsWithHomeActivityFlaggedInvisible() { fun endsWithHomeActivityFlaggedInvisible() {
testSpec.assertWmEnd { testSpec.assertWmEnd {
this.isHomeActivityVisible(false) this.isHomeActivityInvisible()
} }
} }
@@ -204,9 +204,9 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
@Test @Test
fun appWindowBecomesAndStaysVisible() { fun appWindowBecomesAndStaysVisible() {
testSpec.assertWm { testSpec.assertWm {
this.isAppWindowInvisible(testApp.component, ignoreActivity = true) this.isAppWindowInvisible(testApp.component)
.then() .then()
.isAppWindowVisible(testApp.component, ignoreActivity = true) .isAppWindowVisible(testApp.component)
} }
} }
@@ -232,9 +232,9 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
@Test @Test
fun launcherWindowBecomesAndStaysInvisible() { fun launcherWindowBecomesAndStaysInvisible() {
testSpec.assertWm { testSpec.assertWm {
this.isAppWindowVisible(LAUNCHER_COMPONENT) this.isAppWindowOnTop(LAUNCHER_COMPONENT)
.then() .then()
.isAppWindowInvisible(LAUNCHER_COMPONENT) .isAppWindowNotOnTop(LAUNCHER_COMPONENT)
} }
} }
@@ -260,9 +260,9 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
@Test @Test
fun appWindowIsVisibleOnceLauncherWindowIsInvisible() { fun appWindowIsVisibleOnceLauncherWindowIsInvisible() {
testSpec.assertWm { testSpec.assertWm {
this.isAppWindowVisible(LAUNCHER_COMPONENT) this.isAppWindowOnTop(LAUNCHER_COMPONENT)
.then() .then()
.isAppWindowVisible(SNAPSHOT_COMPONENT) .isAppWindowVisible(FlickerComponentName.SNAPSHOT)
.then() .then()
.isAppWindowVisible(testApp.component) .isAppWindowVisible(testApp.component)
} }
@@ -278,7 +278,7 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
testSpec.assertLayers { testSpec.assertLayers {
this.isVisible(LAUNCHER_COMPONENT) this.isVisible(LAUNCHER_COMPONENT)
.then() .then()
.isVisible(SNAPSHOT_COMPONENT) .isVisible(FlickerComponentName.SNAPSHOT)
.then() .then()
.isVisible(testApp.component) .isVisible(testApp.component)
} }

View File

@@ -30,7 +30,7 @@ import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.ROTATION_COMPONENT import com.android.server.wm.traces.common.FlickerComponentName
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@@ -38,8 +38,39 @@ import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized import org.junit.runners.Parameterized
/** /**
* Cycle through supported app rotations. * Test opening an app and cycling through app rotations
*
* Currently runs:
* 0 -> 90 degrees
* 90 -> 0 degrees
*
* Actions:
* Launch an app (via intent)
* Set initial device orientation
* Start tracing
* Change device orientation
* Stop tracing
*
* To run this test: `atest FlickerTests:ChangeAppRotationTest` * To run this test: `atest FlickerTests:ChangeAppRotationTest`
*
* To run only the presubmit assertions add: `--
* --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest
* --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Presubmit`
*
* To run only the postsubmit assertions add: `--
* --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest
* --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Postsubmit`
*
* To run only the flaky assertions add: `--
* --module-arg FlickerTests:include-annotation:androidx.test.filters.FlakyTest`
*
* Notes:
* 1. Some default assertions (e.g., nav bar, status bar and screen covered)
* are inherited [RotationTransition]
* 2. Part of the test setup occurs automatically via
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
* including configuring navigation mode, initial orientation and ensuring no
* apps are running before setup
*/ */
@RequiresDevice @RequiresDevice
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@@ -60,36 +91,51 @@ class ChangeAppRotationTest(
} }
} }
/** {@inheritDoc} */
@FlakyTest(bugId = 190185577) @FlakyTest(bugId = 190185577)
@Test @Test
override fun focusDoesNotChange() { override fun focusDoesNotChange() {
super.focusDoesNotChange() super.focusDoesNotChange()
} }
/**
* Checks that the [FlickerComponentName.ROTATION] layer appears during the transition,
* doesn't flicker, and disappears before the transition is complete
*/
@Presubmit @Presubmit
@Test @Test
fun screenshotLayerBecomesInvisible() { fun rotationLayerAppearsAndVanishes() {
testSpec.assertLayers { testSpec.assertLayers {
this.isVisible(testApp.component) this.isVisible(testApp.component)
.then() .then()
.isVisible(ROTATION_COMPONENT) .isVisible(FlickerComponentName.ROTATION)
.then() .then()
.isVisible(testApp.component) .isVisible(testApp.component)
} }
} }
/**
* Checks that the status bar window is visible and above the app windows in all WM
* trace entries
*/
@Presubmit @Presubmit
@Test @Test
fun statusBarWindowIsVisible() { fun statusBarWindowIsVisible() {
testSpec.statusBarWindowIsVisible() testSpec.statusBarWindowIsVisible()
} }
/**
* Checks that the status bar layer is visible at the start and end of the transition
*/
@Presubmit @Presubmit
@Test @Test
fun statusBarLayerIsVisible() { fun statusBarLayerIsVisible() {
testSpec.statusBarLayerIsVisible() testSpec.statusBarLayerIsVisible()
} }
/**
* Checks the position of the status bar at the start and end of the transition
*/
@Presubmit @Presubmit
@Test @Test
fun statusBarLayerRotatesScales() { fun statusBarLayerRotatesScales() {
@@ -97,13 +143,26 @@ class ChangeAppRotationTest(
testSpec.config.startRotation, testSpec.config.endRotation) testSpec.config.startRotation, testSpec.config.endRotation)
} }
/** {@inheritDoc} */
@FlakyTest @FlakyTest
@Test @Test
override fun navBarLayerRotatesAndScales() { override fun navBarLayerRotatesAndScales() {
super.navBarLayerRotatesAndScales() super.navBarLayerRotatesAndScales()
} }
/** {@inheritDoc} */
@FlakyTest
@Test
override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
super.visibleLayersShownMoreThanOneConsecutiveEntry()
companion object { companion object {
/**
* Creates the test configurations.
*
* See [FlickerTestParameterFactory.getConfigRotationTests] for configuring
* repetitions, screen orientation and navigation modes.
*/
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
@JvmStatic @JvmStatic
fun getParams(): Collection<FlickerTestParameter> { fun getParams(): Collection<FlickerTestParameter> {

View File

@@ -17,7 +17,6 @@
package com.android.server.wm.flicker.rotation package com.android.server.wm.flicker.rotation
import android.app.Instrumentation import android.app.Instrumentation
import android.content.ComponentName
import android.platform.test.annotations.Presubmit import android.platform.test.annotations.Presubmit
import androidx.test.platform.app.InstrumentationRegistry import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider import com.android.server.wm.flicker.FlickerBuilderProvider
@@ -31,9 +30,12 @@ import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsVisible import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.entireScreenCovered import com.android.server.wm.flicker.entireScreenCovered
import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.startRotation
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import org.junit.Test import org.junit.Test
/**
* Base class for app rotation tests
*/
abstract class RotationTransition(protected val testSpec: FlickerTestParameter) { abstract class RotationTransition(protected val testSpec: FlickerTestParameter) {
protected abstract val testApp: StandardAppHelper protected abstract val testApp: StandardAppHelper
@@ -55,6 +57,10 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter)
} }
} }
/**
* Entry point for the test runner. It will use this method to initialize and cache
* flicker executions
*/
@FlickerBuilderProvider @FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder { fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply { return FlickerBuilder(instrumentation).apply {
@@ -62,18 +68,28 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter)
} }
} }
/**
* Checks that the navigation bar window is visible and above the app windows in all WM
* trace entries
*/
@Presubmit @Presubmit
@Test @Test
open fun navBarWindowIsVisible() { open fun navBarWindowIsVisible() {
testSpec.navBarWindowIsVisible() testSpec.navBarWindowIsVisible()
} }
/**
* Checks that the navigation bar layer is visible at the start and end of the transition
*/
@Presubmit @Presubmit
@Test @Test
open fun navBarLayerIsVisible() { open fun navBarLayerIsVisible() {
testSpec.navBarLayerIsVisible() testSpec.navBarLayerIsVisible()
} }
/**
* Checks the position of the navigation bar at the start and end of the transition
*/
@Presubmit @Presubmit
@Test @Test
open fun navBarLayerRotatesAndScales() { open fun navBarLayerRotatesAndScales() {
@@ -81,19 +97,27 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter)
testSpec.config.startRotation, testSpec.config.endRotation) testSpec.config.startRotation, testSpec.config.endRotation)
} }
/**
* Checks that all layers that are visible on the trace, are visible for at least 2
* consecutive entries.
*/
@Presubmit @Presubmit
@Test @Test
open fun visibleLayersShownMoreThanOneConsecutiveEntry() { open fun visibleLayersShownMoreThanOneConsecutiveEntry() {
testSpec.assertLayers { testSpec.assertLayers {
this.visibleLayersShownMoreThanOneConsecutiveEntry( this.visibleLayersShownMoreThanOneConsecutiveEntry(
ignoreLayers = listOf(WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, ignoreLayers = listOf(FlickerComponentName.SPLASH_SCREEN,
WindowManagerStateHelper.SNAPSHOT_COMPONENT, FlickerComponentName.SNAPSHOT,
ComponentName("", "SecondaryHomeHandle") FlickerComponentName("", "SecondaryHomeHandle")
) )
) )
} }
} }
/**
* Checks that all windows that are visible on the trace, are visible for at least 2
* consecutive entries.
*/
@Presubmit @Presubmit
@Test @Test
open fun visibleWindowsShownMoreThanOneConsecutiveEntry() { open fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
@@ -102,10 +126,16 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter)
} }
} }
/**
* Checks that all parts of the screen are covered during the transition
*/
@Presubmit @Presubmit
@Test @Test
open fun entireScreenCovered() = testSpec.entireScreenCovered() open fun entireScreenCovered() = testSpec.entireScreenCovered()
/**
* Checks that the focus doesn't change during animation
*/
@Presubmit @Presubmit
@Test @Test
open fun focusDoesNotChange() { open fun focusDoesNotChange() {
@@ -114,6 +144,9 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter)
} }
} }
/**
* Checks that [testApp] layer covers the entire screen at the start of the transition
*/
@Presubmit @Presubmit
@Test @Test
open fun appLayerRotates_StartingPos() { open fun appLayerRotates_StartingPos() {
@@ -124,6 +157,9 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter)
} }
} }
/**
* Checks that [testApp] layer covers the entire screen at the end of the transition
*/
@Presubmit @Presubmit
@Test @Test
open fun appLayerRotates_EndingPos() { open fun appLayerRotates_EndingPos() {

View File

@@ -27,7 +27,7 @@ import com.android.server.wm.flicker.annotation.Group3
import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.SeamlessRotationAppHelper import com.android.server.wm.flicker.helpers.SeamlessRotationAppHelper
import com.android.server.wm.flicker.testapp.ActivityOptions import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.server.wm.traces.common.FlickerComponentName
import org.junit.FixMethodOrder import org.junit.FixMethodOrder
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@@ -35,8 +35,41 @@ import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized import org.junit.runners.Parameterized
/** /**
* Cycle through supported app rotations using seamless rotations. * Test opening an app and cycling through app rotations using seamless rotations
*
* Currently runs:
* 0 -> 90 degrees
* 0 -> 90 degrees (with starved UI thread)
* 90 -> 0 degrees
* 90 -> 0 degrees (with starved UI thread)
*
* Actions:
* Launch an app in fullscreen and supporting seamless rotation (via intent)
* Set initial device orientation
* Start tracing
* Change device orientation
* Stop tracing
*
* To run this test: `atest FlickerTests:SeamlessAppRotationTest` * To run this test: `atest FlickerTests:SeamlessAppRotationTest`
*
* To run only the presubmit assertions add: `--
* --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest
* --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Presubmit`
*
* To run only the postsubmit assertions add: `--
* --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest
* --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Postsubmit`
*
* To run only the flaky assertions add: `--
* --module-arg FlickerTests:include-annotation:androidx.test.filters.FlakyTest`
*
* Notes:
* 1. Some default assertions (e.g., nav bar, status bar and screen covered)
* are inherited [RotationTransition]
* 2. Part of the test setup occurs automatically via
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
* including configuring navigation mode, initial orientation and ensuring no
* apps are running before setup
*/ */
@RequiresDevice @RequiresDevice
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@@ -61,6 +94,9 @@ class SeamlessAppRotationTest(
} }
} }
/**
* Checks that [testApp] window is always in full screen
*/
@Presubmit @Presubmit
@Test @Test
fun appWindowFullScreen() { fun appWindowFullScreen() {
@@ -75,6 +111,9 @@ class SeamlessAppRotationTest(
} }
} }
/**
* Checks that [testApp] window is always with seamless rotation
*/
@Presubmit @Presubmit
@Test @Test
fun appWindowSeamlessRotation() { fun appWindowSeamlessRotation() {
@@ -90,6 +129,9 @@ class SeamlessAppRotationTest(
} }
} }
/**
* Checks that [testApp] window is always visible
*/
@Presubmit @Presubmit
@Test @Test
fun appLayerAlwaysVisible() { fun appLayerAlwaysVisible() {
@@ -98,6 +140,9 @@ class SeamlessAppRotationTest(
} }
} }
/**
* Checks that [testApp] layer covers the entire screen during the whole transition
*/
@Presubmit @Presubmit
@Test @Test
fun appLayerRotates() { fun appLayerRotates() {
@@ -110,29 +155,36 @@ class SeamlessAppRotationTest(
} }
} }
/**
* Checks that the [FlickerComponentName.STATUS_BAR] window is invisible during the whole
* transition
*/
@Presubmit @Presubmit
@Test @Test
fun statusBarWindowIsAlwaysInvisible() { fun statusBarWindowIsAlwaysInvisible() {
testSpec.assertWm { testSpec.assertWm {
this.isAboveAppWindowInvisible(WindowManagerStateHelper.STATUS_BAR_COMPONENT) this.isAboveAppWindowInvisible(FlickerComponentName.STATUS_BAR)
} }
} }
/**
* Checks that the [FlickerComponentName.STATUS_BAR] layer is invisible during the whole
* transition
*/
@Presubmit @Presubmit
@Test @Test
fun statusBarLayerIsAlwaysInvisible() { fun statusBarLayerIsAlwaysInvisible() {
testSpec.assertLayers { testSpec.assertLayers {
this.isInvisible(WindowManagerStateHelper.STATUS_BAR_COMPONENT) this.isInvisible(FlickerComponentName.STATUS_BAR)
} }
} }
/** {@inheritDoc} */
@FlakyTest @FlakyTest
@Test @Test
override fun navBarLayerRotatesAndScales() = super.navBarLayerRotatesAndScales() override fun navBarLayerRotatesAndScales() = super.navBarLayerRotatesAndScales()
companion object { companion object {
private val testFactory = FlickerTestParameterFactory.getInstance()
private val Map<String, Any?>.starveUiThread private val Map<String, Any?>.starveUiThread
get() = this.getOrDefault(ActivityOptions.EXTRA_STARVE_UI_THREAD, false) as Boolean get() = this.getOrDefault(ActivityOptions.EXTRA_STARVE_UI_THREAD, false) as Boolean
@@ -144,20 +196,34 @@ class SeamlessAppRotationTest(
return config return config
} }
/**
* Creates the test configurations for seamless rotation based on the default rotation
* tests from [FlickerTestParameterFactory.getConfigRotationTests], but adding an
* additional flag ([ActivityOptions.EXTRA_STARVE_UI_THREAD]) to indicate if the app
* should starve the UI thread of not
*/
@JvmStatic @JvmStatic
private fun getConfigurations(): List<FlickerTestParameter> { private fun getConfigurations(): List<FlickerTestParameter> {
return testFactory.getConfigRotationTests(repetitions = 2).flatMap { return FlickerTestParameterFactory.getInstance()
val defaultRun = it.createConfig(starveUiThread = false) .getConfigRotationTests(repetitions = 2)
val busyUiRun = it.createConfig(starveUiThread = true) .flatMap {
listOf( val defaultRun = it.createConfig(starveUiThread = false)
FlickerTestParameter(defaultRun), val busyUiRun = it.createConfig(starveUiThread = true)
FlickerTestParameter(busyUiRun, listOf(
name = "${FlickerTestParameter.defaultName(busyUiRun)}_BUSY_UI_THREAD" FlickerTestParameter(defaultRun),
FlickerTestParameter(busyUiRun,
name = "${FlickerTestParameter.defaultName(busyUiRun)}_BUSY_UI_THREAD"
)
) )
) }
}
} }
/**
* Creates the test configurations.
*
* See [FlickerTestParameterFactory.getConfigRotationTests] for configuring
* repetitions, screen orientation and navigation modes.
*/
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
@JvmStatic @JvmStatic
fun getParams(): Collection<FlickerTestParameter> { fun getParams(): Collection<FlickerTestParameter> {