From b03abbe07ad6dc231885643c4ff9f80323c14f1b Mon Sep 17 00:00:00 2001 From: Nataniel Borges Date: Mon, 24 Jan 2022 18:53:22 +0100 Subject: [PATCH] Support refactored Region class For use in KotlinJS (winscope) the Region class cannot have multiple constructors. JS doesn't support method or constructor overload. This CL make the tests compatible with the newer class version Bug: 216111397 Test: atest WMShellFlickerTests Change-Id: Ifa5f8c6e0063185e2986019b3a27f24c93fe05d2 --- .../src/com/android/wm/shell/flicker/CommonAssertions.kt | 8 ++++---- .../android/wm/shell/flicker/helpers/AppPairsHelper.kt | 4 ++-- .../flicker/legacysplitscreen/ResizeLegacySplitScreen.kt | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/CommonAssertions.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/CommonAssertions.kt index 68b0b4e482528..cb478c84c2b78 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/CommonAssertions.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/CommonAssertions.kt @@ -118,10 +118,10 @@ fun FlickerTestParameter.dockedStackSecondaryBoundsIsVisibleAtEnd( fun getPrimaryRegion(dividerRegion: Region, rotation: Int): Region { val displayBounds = WindowUtils.getDisplayBounds(rotation) return if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) { - Region(0, 0, displayBounds.bounds.right, + Region.from(0, 0, displayBounds.bounds.right, dividerRegion.bounds.top + WindowUtils.dockedStackDividerInset) } else { - Region(0, 0, dividerRegion.bounds.left + WindowUtils.dockedStackDividerInset, + Region.from(0, 0, dividerRegion.bounds.left + WindowUtils.dockedStackDividerInset, displayBounds.bounds.bottom) } } @@ -129,10 +129,10 @@ fun getPrimaryRegion(dividerRegion: Region, rotation: Int): Region { fun getSecondaryRegion(dividerRegion: Region, rotation: Int): Region { val displayBounds = WindowUtils.getDisplayBounds(rotation) return if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) { - Region(0, dividerRegion.bounds.bottom - WindowUtils.dockedStackDividerInset, + Region.from(0, dividerRegion.bounds.bottom - WindowUtils.dockedStackDividerInset, displayBounds.bounds.right, displayBounds.bounds.bottom) } else { - Region(dividerRegion.bounds.right - WindowUtils.dockedStackDividerInset, 0, + Region.from(dividerRegion.bounds.right - WindowUtils.dockedStackDividerInset, 0, displayBounds.bounds.right, displayBounds.bounds.bottom) } } \ No newline at end of file diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/AppPairsHelper.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/AppPairsHelper.kt index efae20731befa..cf4ea467a29b5 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/AppPairsHelper.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/AppPairsHelper.kt @@ -28,14 +28,14 @@ class AppPairsHelper( component: FlickerComponentName ) : BaseAppHelper(instrumentation, activityLabel, component) { fun getPrimaryBounds(dividerBounds: Region): Region { - val primaryAppBounds = Region(0, 0, dividerBounds.bounds.right, + val primaryAppBounds = Region.from(0, 0, dividerBounds.bounds.right, dividerBounds.bounds.bottom + WindowUtils.dockedStackDividerInset) return primaryAppBounds } fun getSecondaryBounds(dividerBounds: Region): Region { val displayBounds = WindowUtils.displayBounds - val secondaryAppBounds = Region(0, + val secondaryAppBounds = Region.from(0, dividerBounds.bounds.bottom - WindowUtils.dockedStackDividerInset, displayBounds.right, displayBounds.bottom - WindowUtils.navigationBarHeight) return secondaryAppBounds diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/ResizeLegacySplitScreen.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/ResizeLegacySplitScreen.kt index 264d482426cb5..a510d699387e7 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/ResizeLegacySplitScreen.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/ResizeLegacySplitScreen.kt @@ -166,9 +166,9 @@ class ResizeLegacySplitScreen( val dividerBounds = layer(DOCKED_STACK_DIVIDER_COMPONENT).visibleRegion.region.bounds - val topAppBounds = Region(0, 0, dividerBounds.right, + val topAppBounds = Region.from(0, 0, dividerBounds.right, dividerBounds.top + WindowUtils.dockedStackDividerInset) - val bottomAppBounds = Region(0, + val bottomAppBounds = Region.from(0, dividerBounds.bottom - WindowUtils.dockedStackDividerInset, displayBounds.right, displayBounds.bottom - WindowUtils.navigationBarHeight) @@ -187,9 +187,9 @@ class ResizeLegacySplitScreen( val dividerBounds = layer(DOCKED_STACK_DIVIDER_COMPONENT).visibleRegion.region.bounds - val topAppBounds = Region(0, 0, dividerBounds.right, + val topAppBounds = Region.from(0, 0, dividerBounds.right, dividerBounds.top + WindowUtils.dockedStackDividerInset) - val bottomAppBounds = Region(0, + val bottomAppBounds = Region.from(0, dividerBounds.bottom - WindowUtils.dockedStackDividerInset, displayBounds.right, displayBounds.bottom - WindowUtils.navigationBarHeight)