summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Liran Binyamin <liranb@google.com> 2025-02-27 15:12:34 -0500
committer Liran Binyamin <liranb@google.com> 2025-02-28 09:40:29 -0500
commit54d66e38f75d676389da71a4e973153e16100364 (patch)
tree9b18682a8a37e6a204bef93cc87bb8346a7a6f47
parent6e63524cf22393bd2e7254ea231a89e2a1141a4e (diff)
Add an unsupported split screen mode
This will allow us to avoid generating split drag zones until the transition from bubble to split is implemented. Flag: EXEMPT not wired Bug: 393172431 Test: atest DragZoneFactoryTest Change-Id: I5d4c1d07fc7926c01c86272d02acaab2a1410dde
-rw-r--r--libs/WindowManager/Shell/multivalentScreenshotTests/src/com/android/wm/shell/shared/bubbles/DragZoneFactoryScreenshotTest.kt1
-rw-r--r--libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/DragZoneFactory.kt6
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/shared/bubbles/DragZoneFactoryTest.kt39
3 files changed, 42 insertions, 4 deletions
diff --git a/libs/WindowManager/Shell/multivalentScreenshotTests/src/com/android/wm/shell/shared/bubbles/DragZoneFactoryScreenshotTest.kt b/libs/WindowManager/Shell/multivalentScreenshotTests/src/com/android/wm/shell/shared/bubbles/DragZoneFactoryScreenshotTest.kt
index 24f43d347163..5777cb0cc8c5 100644
--- a/libs/WindowManager/Shell/multivalentScreenshotTests/src/com/android/wm/shell/shared/bubbles/DragZoneFactoryScreenshotTest.kt
+++ b/libs/WindowManager/Shell/multivalentScreenshotTests/src/com/android/wm/shell/shared/bubbles/DragZoneFactoryScreenshotTest.kt
@@ -94,6 +94,7 @@ class DragZoneFactoryScreenshotTest(private val param: Param) {
private val splitScreenModeName =
when (splitScreenMode) {
+ SplitScreenMode.UNSUPPORTED -> "_split_unsupported"
SplitScreenMode.NONE -> ""
SplitScreenMode.SPLIT_50_50 -> "_split_50_50"
SplitScreenMode.SPLIT_10_90 -> "_split_10_90"
diff --git a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/DragZoneFactory.kt b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/DragZoneFactory.kt
index 1a80b0f29aa9..b3cb72e49727 100644
--- a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/DragZoneFactory.kt
+++ b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/DragZoneFactory.kt
@@ -322,6 +322,7 @@ class DragZoneFactory(
val isVerticalSplit = deviceConfig.isSmallTablet == deviceConfig.isLandscape
return if (isVerticalSplit) {
when (splitScreenModeChecker.getSplitScreenMode()) {
+ SplitScreenMode.UNSUPPORTED -> emptyList()
SplitScreenMode.SPLIT_50_50,
SplitScreenMode.NONE ->
listOf(
@@ -379,6 +380,7 @@ class DragZoneFactory(
}
} else {
when (splitScreenModeChecker.getSplitScreenMode()) {
+ SplitScreenMode.UNSUPPORTED -> emptyList()
SplitScreenMode.SPLIT_50_50,
SplitScreenMode.NONE ->
listOf(
@@ -472,6 +474,7 @@ class DragZoneFactory(
// vertical split drag zones are aligned with the full screen drag zone width
val splitZoneLeft = windowBounds.right / 2 - fullScreenDragZoneWidth / 2
when (splitScreenModeChecker.getSplitScreenMode()) {
+ SplitScreenMode.UNSUPPORTED -> emptyList()
SplitScreenMode.SPLIT_50_50,
SplitScreenMode.NONE ->
listOf(
@@ -579,7 +582,8 @@ class DragZoneFactory(
NONE,
SPLIT_50_50,
SPLIT_10_90,
- SPLIT_90_10
+ SPLIT_90_10,
+ UNSUPPORTED
}
fun getSplitScreenMode(): SplitScreenMode
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/shared/bubbles/DragZoneFactoryTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/shared/bubbles/DragZoneFactoryTest.kt
index fd22a84dee5d..2b39262d9f00 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/shared/bubbles/DragZoneFactoryTest.kt
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/shared/bubbles/DragZoneFactoryTest.kt
@@ -53,7 +53,8 @@ class DragZoneFactoryTest {
tabletPortrait.copy(windowBounds = Rect(0, 0, 800, 900), isSmallTablet = true)
private val foldableLandscape =
foldablePortrait.copy(windowBounds = Rect(0, 0, 900, 800), isLandscape = true)
- private val splitScreenModeChecker = SplitScreenModeChecker { SplitScreenMode.NONE }
+ private var splitScreenMode = SplitScreenMode.NONE
+ private val splitScreenModeChecker = SplitScreenModeChecker { splitScreenMode }
private var isDesktopWindowModeSupported = true
private val desktopWindowModeChecker = DesktopWindowModeChecker { isDesktopWindowModeSupported }
@@ -283,7 +284,7 @@ class DragZoneFactoryTest {
}
@Test
- fun dragZonesForBubble_tablet_desktopModeDisabled() {
+ fun dragZonesForBubble_desktopModeDisabled() {
isDesktopWindowModeSupported = false
dragZoneFactory =
DragZoneFactory(
@@ -298,7 +299,7 @@ class DragZoneFactoryTest {
}
@Test
- fun dragZonesForExpandedView_tablet_desktopModeDisabled() {
+ fun dragZonesForExpandedView_desktopModeDisabled() {
isDesktopWindowModeSupported = false
dragZoneFactory =
DragZoneFactory(
@@ -314,6 +315,38 @@ class DragZoneFactoryTest {
assertThat(dragZones.filterIsInstance<DragZone.DesktopWindow>()).isEmpty()
}
+ @Test
+ fun dragZonesForBubble_splitScreenModeUnsupported() {
+ splitScreenMode = SplitScreenMode.UNSUPPORTED
+ dragZoneFactory =
+ DragZoneFactory(
+ context,
+ foldableLandscape,
+ splitScreenModeChecker,
+ desktopWindowModeChecker
+ )
+ val dragZones =
+ dragZoneFactory.createSortedDragZones(DraggedObject.Bubble(BubbleBarLocation.LEFT))
+ assertThat(dragZones.filterIsInstance<DragZone.Split>()).isEmpty()
+ }
+
+ @Test
+ fun dragZonesForExpandedView_splitScreenModeUnsupported() {
+ splitScreenMode = SplitScreenMode.UNSUPPORTED
+ dragZoneFactory =
+ DragZoneFactory(
+ context,
+ foldableLandscape,
+ splitScreenModeChecker,
+ desktopWindowModeChecker
+ )
+ val dragZones =
+ dragZoneFactory.createSortedDragZones(
+ DraggedObject.ExpandedView(BubbleBarLocation.LEFT)
+ )
+ assertThat(dragZones.filterIsInstance<DragZone.Split>()).isEmpty()
+ }
+
private inline fun <reified T> verifyInstance(): DragZoneVerifier = { dragZone ->
assertThat(dragZone).isInstanceOf(T::class.java)
}