From 02724c041ff5ddbb50241076a4dc01e636c673c9 Mon Sep 17 00:00:00 2001 From: Ioana Moraru Date: Fri, 17 Sep 2021 12:16:14 +0000 Subject: [PATCH] Use the display 0 transform for assertions The first display is not always display 0. For example screen recording creates a virtual display to duplicate the screen. The assertions should use data from display 0. Bug: 188792659 Test: atest FlickerTests Test: atest WMShellFlickerTests Change-Id: I45913d1fb688c0d91e53333e3450d47e3f2faf62 --- .../server/wm/flicker/CommonAssertions.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt index 16cdfcd1e87ab..2753ae0bcc7fe 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt @@ -89,14 +89,14 @@ fun FlickerTestParameter.statusBarLayerIsVisible() { fun FlickerTestParameter.navBarLayerRotatesAndScales() { assertLayersStart { - val rotation = this.entry.displays.firstOrNull()?.transform?.getRotation() - ?: Surface.ROTATION_0 + val rotation = this.entry.displays.sortedBy { it.id } + .firstOrNull()?.transform?.getRotation() ?: Surface.ROTATION_0 this.visibleRegion(FlickerComponentName.NAV_BAR) .coversExactly(WindowUtils.getNavigationBarPosition(rotation)) } assertLayersEnd { - val rotation = this.entry.displays.firstOrNull()?.transform?.getRotation() - ?: Surface.ROTATION_0 + val rotation = this.entry.displays.sortedBy { it.id } + .firstOrNull()?.transform?.getRotation() ?: Surface.ROTATION_0 this.visibleRegion(FlickerComponentName.NAV_BAR) .coversExactly(WindowUtils.getNavigationBarPosition(rotation)) } @@ -104,14 +104,14 @@ fun FlickerTestParameter.navBarLayerRotatesAndScales() { fun FlickerTestParameter.statusBarLayerRotatesScales() { assertLayersStart { - val rotation = this.entry.displays.firstOrNull()?.transform?.getRotation() - ?: Surface.ROTATION_0 + val rotation = this.entry.displays.sortedBy { it.id } + .firstOrNull()?.transform?.getRotation() ?: Surface.ROTATION_0 this.visibleRegion(FlickerComponentName.STATUS_BAR) .coversExactly(WindowUtils.getStatusBarPosition(rotation)) } assertLayersEnd { - val rotation = this.entry.displays.firstOrNull()?.transform?.getRotation() - ?: Surface.ROTATION_0 + val rotation = this.entry.displays.sortedBy { it.id } + .firstOrNull()?.transform?.getRotation() ?: Surface.ROTATION_0 this.visibleRegion(FlickerComponentName.STATUS_BAR) .coversExactly(WindowUtils.getStatusBarPosition(rotation)) }